<div dir="ltr">Bonjour Monsieur Gougeon,<div><br></div><div style>Tout d'abord, merci beaucoup d'avoir pris le temps de me répondre.</div><div style>Je suis enseignant en mathématiques et je voudrais montrer aux élèves de TS spécialité maths une application du calcul matriciel.</div>
<div style><br></div><div style>Pourriez-vous me dire si votre proposition est un arbre qui se construit point par point grâce à la boucle FOR ?</div><div style><br></div><div style>En fait je pensais aussi à utiliser une boucle FOR de la façon suivante par exemple : </div>
<div style><div><pre style="white-space:pre-wrap"><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif;color:black">nPoints</span><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">6000</span></span></pre>
<pre style="white-space:pre-wrap"><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif;color:black">P</span><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">zeros</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">2</span><span style="color:black">,nPoints</span><span style="color:rgb(74,85,219)">)</span><span style="color:black">;</span></span></pre>
<pre style="white-space:pre-wrap"><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif;color:rgb(160,32,240)">for</span><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:black">i</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">2</span><span style="color:rgb(255,170,0)">:</span><span style="color:black">nPoints</span></span></pre>
<pre style="white-space:pre-wrap"><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif;color:black">tirage</span><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">rand</span><span style="color:rgb(74,85,219)">()</span><span style="color:black">;</span></span></pre>
<pre style="white-space:pre-wrap"><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif;color:rgb(160,32,240)">if</span><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:black">tirage</span> <span style="color:rgb(92,92,92)"><</span> <span style="color:rgb(188,143,143)">0.5</span> <span style="color:rgb(160,32,240)">then</span> <span style="color:black">choix</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">1</span><span style="color:black">;</span></span></pre>
<pre style="white-space:pre-wrap"><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif;color:rgb(160,32,240)">else</span><span lang="EN-US" style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:black">choix</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">2</span><span style="color:black">;</span></span></pre>
<pre style="white-space:pre-wrap"><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(160,32,240)">end</span><span style="font-size:9pt;font-family:Monospaced,serif"></span></pre><pre style="white-space:pre-wrap">
<span style="font-size:9pt;font-family:Monospaced,serif;color:black">P</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">(</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(255,170,0)">:</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">,i</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">)</span><span style="font-size:9pt;font-family:Monospaced,serif"> <span style="color:rgb(92,92,92)">=</span> <u><span style="color:black">transformation</span></u><span style="color:rgb(74,85,219)">(</span><span style="color:black">P</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(255,170,0)">:</span><span style="color:black">,i</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(74,85,219)">)</span><span style="color:black">,choix</span><span style="color:rgb(74,85,219)">)</span><span style="color:black">;</span><i><span style="color:rgb(100,174,100)">// P(:,i) est la colonne numéro i</span></i></span></pre>
<pre style="white-space:pre-wrap"><u><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(174,92,176)">plot</span></u><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">(</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">P</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">(</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(188,143,143)">1</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">,</span><span style="font-size:9pt;font-family:Monospaced,serif"><font color="#ffaa00">i</font></span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">)</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">,P</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">(</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(188,143,143)">2</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">,</span><span style="font-size:9pt;font-family:Monospaced,serif"><font color="#ffaa00">i</font></span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">)</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">,</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(188,143,143)">"*b"</span><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(74,85,219)">)</span><span style="font-size:9pt;font-family:Monospaced,serif;color:black">;</span></pre>
<pre style="white-space:pre-wrap"><span style="font-size:9pt;font-family:Monospaced,serif;color:rgb(160,32,240)">end</span><span style="font-size:9pt;font-family:Monospaced,serif"></span></pre><pre style="white-space:pre-wrap">
<br></pre></div><div><br></div><div style>Mais il faut attendre longtemps pour avoir une belle figure.</div><div style>Y aurait-il moyen de maîtriser le temps de construction de la figure, par exemple 30 seconde pour les 6000 points choisis au départ?</div>
<div style><br></div><div style>Cordialement,</div><div style><br></div><div style>JF PIETRI</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">Le 4 juillet 2014 21:19, Samuel Gougeon <span dir="ltr"><<a href="mailto:sgougeon@free.fr" target="_blank">sgougeon@free.fr</a>></span> a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Bonjour,<br>
<br>
Le 04/07/2014 12:18, Jean-François PIETRI a écrit :<br>
</div><div class="">
<blockquote type="cite">
<div dir="ltr">Bonjour,
<div><br>
</div>
<div>Le programme ci-dessous permet d'obtenir le dragon
de Heighway, mais je regrette qu'il arrive d'un bloc.</div>
<div>Comme je me lance à peine avec scilab, quelqu'un
pourrait-il me dire comment le modifier pour que le dragon
apparaisse progressivement en 30 secondes par exemple.</div>
</div>
</blockquote></div>
Voici une possible mise en oeuvre :<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0"><div class=""><span style="color:rgb(176,24,19)">function</span> <span style="color:rgb(131,67,16);font-weight:bold">point_image</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(0,0,0)">transformation</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(131,67,16);font-weight:bold">point_antecedent</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(131,67,16);font-weight:bold">choix</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(160,32,240)">if</span> <span style="color:rgb(131,67,16);font-weight:bold">choix</span> <span style="color:rgb(92,92,92)">==</span> <span style="color:rgb(188,143,143)">1</span> <span style="color:rgb(160,32,240)">then</span>
<span style="color:rgb(0,0,0)">A</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(74,85,219)">[</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(74,85,219)">]</span> <span style="color:rgb(0,0,0)">;</span> <span style="color:rgb(0,0,0)">V</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(188,143,143)">0</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(160,32,240)">end</span>
<span style="color:rgb(160,32,240)">if</span> <span style="color:rgb(131,67,16);font-weight:bold">choix</span> <span style="color:rgb(92,92,92)">==</span> <span style="color:rgb(188,143,143)">2</span> <span style="color:rgb(160,32,240)">then</span>
<span style="color:rgb(0,0,0)">A</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(74,85,219)">[</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(74,85,219)">]</span> <span style="color:rgb(0,0,0)">;</span> <span style="color:rgb(0,0,0)">V</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(188,143,143)">0</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(160,32,240)">end</span>
<span style="color:rgb(131,67,16);font-weight:bold">point_image</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">A</span> <span style="color:rgb(92,92,92)">*</span> <span style="color:rgb(131,67,16);font-weight:bold">point_antecedent</span> <span style="color:rgb(92,92,92)">+</span> <span style="color:rgb(0,0,0)">V</span>
<span style="color:rgb(176,24,19)">endfunction</span>
<span style="color:rgb(0,0,0)">nPoints</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">6000</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">P</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">zeros</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">2</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">nPoints</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
</div><span style="color:rgb(174,92,176);text-decoration:underline">clf</span>
<span style="color:rgb(174,92,176);text-decoration:underline">plot</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">*b</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(0,0,0)">c</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(174,92,176);text-decoration:underline">gce</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">c</span><span style="color:rgb(92,92,92)">.</span><span style="color:rgb(170,170,170)">parent</span><span style="color:rgb(92,92,92)">.</span><span style="color:rgb(170,170,170)">data_bounds</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(74,85,219)">[</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">0.4</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">0.4</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(188,143,143)">1.2</span> <span style="color:rgb(188,143,143)">0.7</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">c</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">c</span><span style="color:rgb(92,92,92)">.</span><span style="color:rgb(170,170,170)">children</span><span style="color:rgb(0,0,0)">;</span><div class="">
<span style="color:rgb(160,32,240)">for</span> <span style="color:rgb(0,0,0)">i</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">2</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(0,0,0)">nPoints</span>
<span style="color:rgb(0,0,0)">tirage</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">rand</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(160,32,240)">if</span> <span style="color:rgb(0,0,0)">tirage</span> <span style="color:rgb(92,92,92)"><</span> <span style="color:rgb(188,143,143)">0.5</span> <span style="color:rgb(160,32,240)">then</span> <span style="color:rgb(0,0,0)">choix</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(160,32,240)">else</span> <span style="color:rgb(0,0,0)">choix</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">2</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(160,32,240)">end</span></div>
<span style="color:rgb(0,0,0)">tmp</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">transformation</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">P</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">choix</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(100,174,100);font-style:italic">// P(:,i) est la colonne numéro i</span>
<span style="color:rgb(0,0,0)">c</span><span style="color:rgb(92,92,92)">.</span><span style="color:rgb(170,170,170)">data</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(255,170,0)">$</span><span style="color:rgb(92,92,92)">+</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(74,85,219)">)</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">tmp</span><span style="color:rgb(92,92,92)">.'</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">P</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(74,85,219)">)</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">tmp</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(160,32,240)">end</span></pre>
<br>
</div>
<br>_______________________________________________<br>
enseignement mailing list<br>
<a href="mailto:enseignement@lists.scilab.org">enseignement@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/enseignement" target="_blank">http://lists.scilab.org/mailman/listinfo/enseignement</a><br>
<br></blockquote></div><br></div>