This commit is contained in:
parent
41f58f1a81
commit
149d6b67d5
|
@ -13124,18 +13124,18 @@ div#notebook {
|
|||
</div><div class="inner_cell">
|
||||
<div class="text_cell_render border-box-sizing rendered_html">
|
||||
<h2 id="Graphique-de-fonctions">Graphique de fonctions<a class="anchor-link" href="#Graphique-de-fonctions">¶</a></h2><p>Nous allons tracer la représentation graphique de</p>
|
||||
$$ f : x \mapsto \frac{x^2}{10} - 5 $$<p><strong>Recopier</strong> le programme suivant, <strong>compléter</strong> les pointillés et calculer les images jusqu'à 8.</p>
|
||||
$$ f : x \mapsto x^2 - 10x + 20 $$<p><strong>Recopier</strong> le programme suivant, <strong>compléter</strong> les pointillés et calculer les images jusqu'à 8.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell border-box-sizing code_cell rendered">
|
||||
<div class="input">
|
||||
<div class="prompt input_prompt">In [3]:</div>
|
||||
<div class="prompt input_prompt">In [1]:</div>
|
||||
<div class="inner_cell">
|
||||
<div class="input_area">
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">/</span><span class="mi">10</span> <span class="o">-</span> <span class="mi">5</span>
|
||||
<span class="k">return</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">10</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="mi">20</span>
|
||||
|
||||
<span class="c1"># image de 0</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">)</span>
|
||||
|
@ -13179,7 +13179,7 @@ L'image de ... est ...
|
|||
</div>
|
||||
<div class="cell border-box-sizing code_cell rendered">
|
||||
<div class="input">
|
||||
<div class="prompt input_prompt">In [4]:</div>
|
||||
<div class="prompt input_prompt">In [2]:</div>
|
||||
<div class="inner_cell">
|
||||
<div class="input_area">
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
|
||||
|
@ -13193,7 +13193,7 @@ L'image de ... est ...
|
|||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span> <span class="s2">"On l'ajoute à la liste"</span><span class="p">)</span>
|
||||
<span class="n">antecedents</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># On ajoute (append) 0 à la liste des antecedents</span>
|
||||
<span class="c1"># image de 1</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span> <span class="s2">"On l'ajoute à la liste"</span><span class="p">)</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
@ -13268,10 +13268,10 @@ L'image de ... est ... On l'ajoute à la liste
|
|||
</div><div class="inner_cell">
|
||||
<div class="text_cell_render border-box-sizing rendered_html">
|
||||
<p>Vous avez tracer la courbe représentative de de la fonction $f$.</p>
|
||||
<p><img src="./fig/cos_pas1.png" alt="Représentation graphique de f"></p>
|
||||
<p>Dans un nouveau fichier, <strong>tracer</strong> la courbe représentative pour x allant de 0 à 50 de la fonction $g$ tel que
|
||||
$$ g : x \mapsto x^2 - 4$$</p>
|
||||
<p><img src="./fig/g_pas1.png" alt="Représentation graphique de f"></p>
|
||||
<p><img src="./fig/plt_f.png" alt="Représentation graphique de f"></p>
|
||||
<p>Dans un nouveau fichier, <strong>tracer</strong> la courbe représentative pour x allant de 0 à 15 de la fonction $g$ tel que
|
||||
$$ g : x \mapsto -(x - 5)^2 + 5$$</p>
|
||||
<p><img src="./fig/plt_g.png" alt="Représentation graphique de f"></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13279,7 +13279,8 @@ $$ g : x \mapsto x^2 - 4$$</p>
|
|||
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
|
||||
</div><div class="inner_cell">
|
||||
<div class="text_cell_render border-box-sizing rendered_html">
|
||||
<h2 id="Précision-et-controle-du-tracé">Précision et controle du tracé<a class="anchor-link" href="#Précision-et-controle-du-tracé">¶</a></h2><p>Pour le moment, on sait donner un maximum à l'antécédent $x$ mais on ne peut pas contrôler le minimum ni le pas (l'écart en 2 valeurs de $x$). Or pour tracer précisément la représentation graphique d'une fonction, nous avons besoin de contrôler la fenêtre (minimum et maximum) et le pas.</p>
|
||||
<h2 id="Précision-et-controle-du-tracé">Précision et controle du tracé<a class="anchor-link" href="#Précision-et-controle-du-tracé">¶</a></h2><p>Pour le moment, on sait donner un maximum à l'antécédent $x$ mais on ne peut pas contrôler le minimum ni le pas (l'écart en 2 valeurs de $x$).</p>
|
||||
<p>Or pour tracer précisément la représentation graphique d'une fonction, nous avons besoin de contrôler la <strong>fenêtre</strong> (minimum et maximum) et le <strong>pas</strong>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13287,7 +13288,7 @@ $$ g : x \mapsto x^2 - 4$$</p>
|
|||
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
|
||||
</div><div class="inner_cell">
|
||||
<div class="text_cell_render border-box-sizing rendered_html">
|
||||
<h2 id="Boucle-while-(tant-que-)">Boucle <code>while</code> (tant que )<a class="anchor-link" href="#Boucle-while-(tant-que-)">¶</a></h2><p>Ce type de boucle donne plus de contrôle sur $x$ et nous évite d'utiliser <code>range</code> qui est une commande qui n'existe que en Python.</p>
|
||||
<h2 id="Boucle-while-(tant-que-)">Boucle <code>while</code> (tant que )<a class="anchor-link" href="#Boucle-while-(tant-que-)">¶</a></h2><p>Une boucle <code>while</code> permet de répeter une ou plusieurs actions <strong>tant qu'</strong> une condition est vérifiée.</p>
|
||||
<p>Les 2 programmes ci-dessous font la même chose.</p>
|
||||
|
||||
</div>
|
||||
|
@ -13295,21 +13296,77 @@ $$ g : x \mapsto x^2 - 4$$</p>
|
|||
</div>
|
||||
<div class="cell border-box-sizing code_cell rendered">
|
||||
<div class="input">
|
||||
<div class="prompt input_prompt">In [ ]:</div>
|
||||
<div class="prompt input_prompt">In [3]:</div>
|
||||
<div class="inner_cell">
|
||||
<div class="input_area">
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="mi">1</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="output_wrapper">
|
||||
<div class="output">
|
||||
|
||||
|
||||
<div class="output_area">
|
||||
|
||||
<div class="prompt"></div>
|
||||
|
||||
|
||||
<div class="output_subarea output_stream output_stdout output_text">
|
||||
<pre>0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cell border-box-sizing code_cell rendered">
|
||||
<div class="input">
|
||||
<div class="prompt input_prompt">In [ ]:</div>
|
||||
<div class="prompt input_prompt">In [4]:</div>
|
||||
<div class="inner_cell">
|
||||
<div class="input_area">
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
|
@ -13322,6 +13379,33 @@ $$ g : x \mapsto x^2 - 4$$</p>
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="output_wrapper">
|
||||
<div class="output">
|
||||
|
||||
|
||||
<div class="output_area">
|
||||
|
||||
<div class="prompt"></div>
|
||||
|
||||
|
||||
<div class="output_subarea output_stream output_stdout output_text">
|
||||
<pre>0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
|
||||
</div><div class="inner_cell">
|
||||
|
@ -13346,9 +13430,22 @@ $$ g : x \mapsto x^2 - 4$$</p>
|
|||
<span class="n">images</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">antecedants</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">20</span><span class="p">):</span>
|
||||
<span class="n">images</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">h</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
|
||||
<span class="n">antecedants</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="c1"># image de 0</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span> <span class="s2">"On les ajoute à la liste"</span><span class="p">)</span>
|
||||
<span class="n">antecedents</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">images</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">h</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># image de 1</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span> <span class="s2">"On les ajoute à la liste"</span><span class="p">)</span>
|
||||
<span class="n">antecedents</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">images</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">h</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># ....</span>
|
||||
|
||||
<span class="c1"># image de 20</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"L'image de"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span><span class="s2">" est"</span><span class="p">,</span> <span class="s2">"..."</span><span class="p">,</span> <span class="s2">"On les ajoute à la liste"</span><span class="p">)</span>
|
||||
<span class="n">antecedents</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">20</span><span class="p">)</span>
|
||||
<span class="n">images</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">h</span><span class="p">(</span><span class="mi">20</span><span class="p">))</span>
|
||||
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"Les images sont "</span><span class="p">,</span> <span class="n">images</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
|
Loading…
Reference in New Issue