Feat: Export update to html
This commit is contained in:
parent
1a9879891c
commit
dd3954534e
|
@ -13123,71 +13123,106 @@ div#notebook {
|
|||
<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="Graphique-de-fonctions">Graphique de fonctions<a class="anchor-link" href="#Graphique-de-fonctions">¶</a></h2><p>Dans cet échauffement, nous allons calculer les images d'une fonction pour tracer sa représentation graphique.</p>
|
||||
<p><strong>Recopier</strong> le programme suivant.</p>
|
||||
<p><strong>Modifier</strong> la ligne avec le <code>print</code> pour faire apparaitre l'image et l'antécédent à chaque ligne.</p>
|
||||
<p><strong>Commenter</strong> chaque ligne avec une attention particulière à la ligne qui commence par <code>for...</code></p>
|
||||
<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>
|
||||
|
||||
</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 [3]:</div>
|
||||
<div class="inner_cell">
|
||||
<div class="input_area">
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">math</span> <span class="k">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">pi</span>
|
||||
<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">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">cos</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">2</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">40</span><span class="p">):</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">f</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="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>
|
||||
</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>L'image de ... est ...
|
||||
L'image de ... est ...
|
||||
</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">
|
||||
<div class="text_cell_render border-box-sizing rendered_html">
|
||||
<p>Pour tracer le graphique de cette fonction, il faudrait <em>enregistrer</em> toutes ces valeurs et donc utiliser des variables.</p>
|
||||
<p>Mettre plusieurs valeurs dans une seule variable c'est possible, on utilise des <code>listes</code> (on les a déjà rencontré plusieurs fois).</p>
|
||||
<p><strong>Recopier</strong> ce programme, <strong>commenter</strong> ce programme et retrouver où les listes apparaissent.</p>
|
||||
<p><strong>Recopier et compléter</strong> ce programme pour enregistrer les images et les antécédents jusqu'à 10.</p>
|
||||
|
||||
</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="kn">from</span> <span class="nn">math</span> <span class="k">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">pi</span>
|
||||
<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">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">cos</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
|
||||
<span class="n">images</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># La liste est vide</span>
|
||||
<span class="n">antecedents</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
|
||||
<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">f</span><span class="p">(</span><span class="n">x</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>
|
||||
<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 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>
|
||||
</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>L'image de ... est ... On l'ajoute à la liste
|
||||
L'image de ... est ... On l'ajoute à la liste
|
||||
</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">
|
||||
<div class="text_cell_render border-box-sizing rendered_html">
|
||||
<p><strong>Modifier</strong> votre programme pour enregistrer aussi les antecedants et les afficher à la fin</p>
|
||||
<p>Nous allons maintenant enfin pouvoir tracer le graphique.</p>
|
||||
<p><strong>Ajouter</strong> la ligne suivante au début de votre programme.</p>
|
||||
|
||||
|
@ -13196,7 +13231,7 @@ div#notebook {
|
|||
</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 [1]:</div>
|
||||
<div class="inner_cell">
|
||||
<div class="input_area">
|
||||
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
|
||||
|
@ -13234,7 +13269,7 @@ div#notebook {
|
|||
<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 de la fonction $g$ tel que
|
||||
<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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue