Commit 82b63fbd authored by Jérôme Ortais's avatar Jérôme Ortais
Browse files

Ajout des testcode dans la documentation Sphinx, amélioration des

classes Fractions, PolynomesCollege et de Priorites3
Tous les exercices du collège fonctionnent.
parent 8d73596b
......@@ -78,7 +78,7 @@
<span class="sd"> code permet de préciser si une décomposition a pour objectif une mise au</span>
<span class="sd"> même dénominateur &#39;r&#39; ou une simplification &#39;s&#39;</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.Fractions.Fractions import Fraction</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.classes.Fractions import Fraction</span>
<span class="sd"> &gt;&gt;&gt; Fraction(5,6)</span>
<span class="sd"> Fraction(5, 6)</span>
<span class="sd"> &gt;&gt;&gt; Fraction(&#39;x&#39;,6)</span>
......@@ -110,16 +110,16 @@
<div class="viewcode-block" id="Fraction.__str__"><a class="viewcode-back" href="../../../pyromaths.classes.Fractions.html#pyromaths.classes.Fractions.Fraction.__str__">[docs]</a> <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**str**\ (*object*)</span>
<span class="sd">r&quot;&quot;&quot;**str**\ (*object*)</span>
<span class="sd"> Renvoie une version LaTeX de la :class:`Fraction`.</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.classes.Fractions import Fraction</span>
<span class="sd"> &gt;&gt;&gt; str(Fraction(5,6))</span>
<span class="sd"> &#39;\\\\dfrac{5}{6}&#39;</span>
<span class="sd"> &#39;\\dfrac{5}{6}&#39;</span>
<span class="sd"> &gt;&gt;&gt; str(Fraction(&#39;-72*2&#39;, &#39;11*2&#39;, &#39;r&#39;))</span>
<span class="sd"> &#39;\\\\dfrac{-72_{\\\\times 2}}{11_{\\\\times 2}}&#39;</span>
<span class="sd"> &#39;\\dfrac{-72_{\\times 2}}{11_{\\times 2}}&#39;</span>
<span class="sd"> &gt;&gt;&gt; str(Fraction(&#39;-72*2&#39;, &#39;11*2&#39;, &#39;s&#39;))</span>
<span class="sd"> &#39;\\\\dfrac{-72\\\\times \\\\cancel{2}}{11\\\\times \\\\cancel{2}}&#39;</span>
<span class="sd"> &#39;\\dfrac{-72\\times \\cancel{2}}{11\\times \\cancel{2}}&#39;</span>
<span class="sd"> :rtype: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
......@@ -127,18 +127,18 @@
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">n</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">code</span> <span class="o">==</span> <span class="s">&quot;r&quot;</span><span class="p">:</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">dfrac{</span><span class="si">%s</span><span class="s">_{</span><span class="se">\\</span><span class="s">times </span><span class="si">%s</span><span class="s">}}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">)))</span>
<span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;{</span><span class="si">%s</span><span class="s">_{</span><span class="se">\\</span><span class="s">times </span><span class="si">%s</span><span class="s">}}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;*&#39;</span><span class="p">)))</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">r&quot;\dfrac{</span><span class="si">%s</span><span class="s">_{\times </span><span class="si">%s</span><span class="s">}}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">)))</span>
<span class="n">text</span> <span class="o">+=</span> <span class="s">r&quot;{</span><span class="si">%s</span><span class="s">_{\times </span><span class="si">%s</span><span class="s">}}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;*&#39;</span><span class="p">)))</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">code</span> <span class="o">==</span> <span class="s">&quot;s&quot;</span><span class="p">:</span>
<span class="n">ln</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;*&#39;</span><span class="p">)</span>
<span class="n">ld</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;*&#39;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">ln</span><span class="p">)):</span>
<span class="k">if</span> <span class="n">ld</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]):</span>
<span class="n">ld</span><span class="p">[</span><span class="n">ld</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">])]</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">cancel{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
<span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">cancel{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">dfrac{</span><span class="si">%s</span><span class="s">}{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">times &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">ln</span><span class="p">),</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">times &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">ld</span><span class="p">))</span>
<span class="n">ld</span><span class="p">[</span><span class="n">ld</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">])]</span> <span class="o">=</span> <span class="s">r&quot;\cancel{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
<span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="s">r&quot;\cancel{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="n">ln</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">r&quot;\dfrac{</span><span class="si">%s</span><span class="s">}{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="s">r&quot;\times &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">ln</span><span class="p">),</span> <span class="s">r&quot;\times &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">ld</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">dfrac{</span><span class="si">%s</span><span class="s">}{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">)</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">r&quot;\dfrac{</span><span class="si">%s</span><span class="s">}{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">&quot;0&quot;</span>
<span class="k">return</span> <span class="n">text</span>
......@@ -195,8 +195,11 @@
<span class="sd"> **TODO :** Attention, 1+3/4 donne 1*4/1*4 + 3/4 à la place de 4/4+3/4. À corriger</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span><span class="nb">int</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span><span class="nb">float</span><span class="p">)):</span>
<span class="kn">from</span> <span class="nn">pyromaths.classes.PolynomesCollege</span> <span class="kn">import</span> <span class="n">Polynome</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">)):</span>
<span class="n">other</span><span class="o">=</span><span class="n">Fraction</span><span class="p">(</span><span class="n">other</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">Polynome</span><span class="p">):</span>
<span class="k">return</span> <span class="n">Polynome</span><span class="p">([[</span><span class="bp">self</span><span class="p">,</span> <span class="mi">0</span><span class="p">]],</span> <span class="n">other</span><span class="o">.</span><span class="n">var</span><span class="p">)</span> <span class="o">+</span> <span class="n">other</span>
<span class="n">leppcm</span> <span class="o">=</span> <span class="n">ppcm</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">,</span> <span class="n">other</span><span class="o">.</span><span class="n">d</span><span class="p">)</span>
<span class="k">if</span> <span class="n">other</span><span class="o">.</span><span class="n">d</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">:</span>
<span class="k">return</span> <span class="n">Fraction</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span> <span class="o">+</span> <span class="n">other</span><span class="o">.</span><span class="n">n</span><span class="p">,</span> <span class="n">leppcm</span><span class="p">)</span>
......@@ -236,9 +239,11 @@
<span class="sd"> *other* peut être une chaîne représentant une fraction, un entier ou un réel.</span>
<span class="sd"> Pour plus de détails, voir :py:func:`__add__`&quot;&quot;&quot;</span>
<span class="c"># return self + (-fraction)</span>
<span class="k">if</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span><span class="nb">int</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span><span class="nb">float</span><span class="p">)):</span>
<span class="kn">from</span> <span class="nn">pyromaths.classes.PolynomesCollege</span> <span class="kn">import</span> <span class="n">Polynome</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">)):</span>
<span class="n">other</span><span class="o">=</span><span class="n">Fraction</span><span class="p">(</span><span class="n">other</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">Polynome</span><span class="p">):</span>
<span class="k">return</span> <span class="n">Polynome</span><span class="p">([[</span><span class="bp">self</span><span class="p">,</span> <span class="mi">0</span><span class="p">]],</span> <span class="n">other</span><span class="o">.</span><span class="n">var</span><span class="p">)</span> <span class="o">-</span> <span class="n">other</span>
<span class="n">leppcm</span> <span class="o">=</span> <span class="n">ppcm</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">,</span> <span class="n">other</span><span class="o">.</span><span class="n">d</span><span class="p">)</span>
<span class="k">if</span> <span class="n">other</span><span class="o">.</span><span class="n">d</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">:</span>
<span class="k">return</span> <span class="n">Fraction</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span> <span class="o">-</span> <span class="n">other</span><span class="o">.</span><span class="n">n</span><span class="p">,</span> <span class="n">leppcm</span><span class="p">)</span>
......@@ -287,10 +292,13 @@
<span class="sd"> :rtype: Fraction ou string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">pyromaths.classes.PolynomesCollege</span> <span class="kn">import</span> <span class="n">Polynome</span>
<span class="kn">from</span> <span class="nn">pyromaths.classes.Polynome</span> <span class="kn">import</span> <span class="n">Polynome</span> <span class="k">as</span> <span class="n">PolynomeLycee</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">)):</span>
<span class="n">other</span><span class="o">=</span><span class="n">Fraction</span><span class="p">(</span><span class="n">other</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">Polynome</span><span class="p">):</span>
<span class="k">return</span> <span class="n">Polynome</span><span class="p">(</span><span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span><span class="o">*</span><span class="n">other</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">PolynomeLycee</span><span class="p">):</span>
<span class="k">return</span> <span class="n">PolynomeLycee</span><span class="p">({</span><span class="mi">1</span><span class="p">:</span> <span class="bp">self</span><span class="p">},</span> <span class="n">var</span><span class="o">=</span><span class="n">other</span><span class="o">.</span><span class="n">var</span><span class="p">)</span><span class="o">*</span><span class="n">other</span>
<span class="n">s</span> <span class="o">=</span> <span class="nb">abs</span><span class="p">(</span><span class="n">pgcd</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="o">*</span><span class="n">other</span><span class="o">.</span><span class="n">n</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="o">*</span><span class="n">other</span><span class="o">.</span><span class="n">d</span><span class="p">))</span>
<span class="k">if</span> <span class="n">s</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">if</span> <span class="n">other</span><span class="o">.</span><span class="n">n</span> <span class="o">==</span> <span class="n">s</span><span class="p">:</span>
......@@ -377,7 +385,7 @@
<span class="sd"> &gt;&gt;&gt; from pyromaths.classes.Fractions import Fraction</span>
<span class="sd"> &gt;&gt;&gt; ~Fraction(8,27)</span>
<span class="sd"> Fraction(27, 8, )</span>
<span class="sd"> Fraction(27, 8)</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">Fraction</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">d</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">n</span><span class="p">)</span>
</div>
......
......@@ -79,7 +79,7 @@
<div class="viewcode-block" id="tex_coef"><a class="viewcode-back" href="../../../pyromaths.outils.Affichage.html#pyromaths.outils.Affichage.tex_coef">[docs]</a><span class="k">def</span> <span class="nf">tex_coef</span><span class="p">(</span><span class="n">coef</span><span class="p">,</span> <span class="n">var</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">bplus</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">bpn</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">bpc</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**tex_coef**\ (*coef*\ [, *var*\ [, *bplus*\ [, *bpn*\ [, *bpc*\ ]]]])</span>
<span class="sd">r&quot;&quot;&quot;**tex_coef**\ (*coef*\ [, *var*\ [, *bplus*\ [, *bpn*\ [, *bpc*\ ]]]])</span>
<span class="sd"> Gère l&#39;affichage d&#39;un monôme (par défaut de degré 0) au format TeX. Permet</span>
......@@ -155,7 +155,7 @@
<span class="k">return</span> <span class="n">TeX</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">fractex</span><span class="o">=</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">frac&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="TeX"><a class="viewcode-back" href="../../../pyromaths.outils.Affichage.html#pyromaths.outils.Affichage.TeX">[docs]</a><span class="k">def</span> <span class="nf">TeX</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">parenthese</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">terme</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">fractex</span><span class="o">=</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">dfrac&quot;</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**TeX**\ (*nombre*\ [, *parenthese*\ [, *terme*\ [, *fractex*\ ]]])</span>
<span class="sd">r&quot;&quot;&quot;**TeX**\ (*nombre*\ [, *parenthese*\ [, *terme*\ [, *fractex*\ ]]])</span>
<span class="sd"> Permet l&#39;affichage de nombres au format TeX. Fait en partie double emploi avec tex_coef. Permet</span>
......@@ -175,11 +175,10 @@
<span class="sd"> :type fractex: string</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.outils import Affichage</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.classes import Fractions</span>
<span class="sd"> &gt;&gt;&gt; f=Fractions.Fraction(7,3)</span>
<span class="sd"> &gt;&gt;&gt; Affichage.TeX(f)</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.classes.Fractions import Fraction</span>
<span class="sd"> &gt;&gt;&gt; Affichage.TeX(Fraction(7,3))</span>
<span class="sd"> &#39;\\dfrac{7}{3} &#39;</span>
<span class="sd"> &gt;&gt;&gt; Affichage.TeX(f,fractex=&#39;\\frac&#39;)</span>
<span class="sd"> &gt;&gt;&gt; Affichage.TeX(Fraction(7,3),fractex=&#39;\\frac&#39;)</span>
<span class="sd"> &#39;\\frac{7}{3} &#39;</span>
<span class="sd"> :rtype: string</span>
......@@ -190,37 +189,37 @@
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Racine</span><span class="o">.</span><span class="n">RacineDegre2</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">radicande</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="c"># Affiche la RacineDegre2 comme une Fractions</span>
<span class="n">nombre</span> <span class="o">=</span> <span class="n">Fraction</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span><span class="p">,</span> <span class="n">nombre</span><span class="o">.</span><span class="n">denominateur</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Fraction</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">denominateur</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Fraction</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">d</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="c"># Affiche la Fractions comme un entier</span>
<span class="n">nombre</span> <span class="o">=</span> <span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span>
<span class="n">nombre</span> <span class="o">=</span> <span class="n">nombre</span><span class="o">.</span><span class="n">n</span>
<span class="c"># parentheses des fractions</span>
<span class="k">if</span> <span class="n">parenthese</span> <span class="ow">and</span> <span class="p">(</span>
<span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Racine</span><span class="o">.</span><span class="n">RacineDegre2</span><span class="p">)</span>
<span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">denominateur</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span> <span class="ow">or</span> <span class="n">nombre</span><span class="o">.</span><span class="n">coeff</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span>
<span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">d</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">n</span> <span class="ow">or</span> <span class="n">nombre</span><span class="o">.</span><span class="n">coeff</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span>
<span class="c"># RacineDegre2 avec radicande nécessairement grâce au tri</span>
<span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Fraction</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span> <span class="o">&lt;</span> <span class="mi">0</span>
<span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Fraction</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">n</span> <span class="o">&lt;</span> <span class="mi">0</span>
<span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span> <span class="o">&lt;</span> <span class="mi">0</span>
<span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="nb">float</span><span class="p">)</span> <span class="ow">and</span> <span class="n">nombre</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">):</span>
<span class="n">strTeX</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">left(&quot;</span>
<span class="n">finTeX</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">right)&quot;</span>
<span class="k">elif</span> <span class="n">terme</span> <span class="ow">and</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Racine</span><span class="o">.</span><span class="n">RacineDegre2</span><span class="p">)</span> <span class="ow">and</span>
<span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">denominateur</span> <span class="o">!=</span> <span class="mi">1</span> <span class="ow">or</span> <span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">coeff</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">))</span>
<span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">d</span> <span class="o">!=</span> <span class="mi">1</span> <span class="ow">or</span> <span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">n</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">nombre</span><span class="o">.</span><span class="n">n</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">nombre</span><span class="o">.</span><span class="n">coeff</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">))</span>
<span class="ow">or</span> <span class="n">nombre</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">:</span>
<span class="n">strTeX</span> <span class="o">=</span> <span class="s">&quot;+&quot;</span>
<span class="n">finTeX</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
<span class="c"># #Affichage</span>
<span class="k">if</span> <span class="n">nombre</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">))</span> <span class="ow">and</span> <span class="n">nombre</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">):</span>
<span class="k">return</span> <span class="s">&quot;+</span><span class="se">\\</span><span class="s">infty &quot;</span>
<span class="k">elif</span> <span class="n">nombre</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;-inf&quot;</span><span class="p">):</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">))</span> <span class="ow">and</span> <span class="n">nombre</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;-inf&quot;</span><span class="p">):</span>
<span class="k">return</span> <span class="s">&quot;-</span><span class="se">\\</span><span class="s">infty &quot;</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="nb">float</span><span class="p">):</span>
<span class="k">return</span> <span class="n">strTeX</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="p">)</span> <span class="o">+</span> <span class="n">finTeX</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Fraction</span><span class="p">):</span>
<span class="k">if</span> <span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">strTeX</span> <span class="o">+=</span> <span class="s">&quot;-&quot;</span> <span class="o">+</span> <span class="n">fractex</span> <span class="o">+</span> <span class="s">&quot;{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="o">-</span><span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">denominateur</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;} &quot;</span>
<span class="k">if</span> <span class="n">nombre</span><span class="o">.</span><span class="n">n</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">strTeX</span> <span class="o">+=</span> <span class="s">&quot;-&quot;</span> <span class="o">+</span> <span class="n">fractex</span> <span class="o">+</span> <span class="s">&quot;{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="o">-</span><span class="n">nombre</span><span class="o">.</span><span class="n">n</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">d</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;} &quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">strTeX</span> <span class="o">+=</span> <span class="n">fractex</span> <span class="o">+</span> <span class="s">&quot;{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">numerateur</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">denominateur</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;} &quot;</span>
<span class="n">strTeX</span> <span class="o">+=</span> <span class="n">fractex</span> <span class="o">+</span> <span class="s">&quot;{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">n</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}{&quot;</span> <span class="o">+</span> <span class="n">decimaux</span><span class="p">(</span><span class="n">nombre</span><span class="o">.</span><span class="n">d</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;} &quot;</span>
<span class="n">strTeX</span> <span class="o">+=</span> <span class="n">finTeX</span>
<span class="k">return</span> <span class="n">strTeX</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">nombre</span><span class="p">,</span> <span class="n">Racine</span><span class="o">.</span><span class="n">RacineDegre2</span><span class="p">):</span>
......
......@@ -100,8 +100,8 @@
<span class="sd"> :type a,b: integer</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.outils import Arithmetique</span>
<span class="sd"> &gt;&gt;&gt; Arithmetique.ppcm(64,72)</span>
<span class="sd"> 572</span>
<span class="sd"> &gt;&gt;&gt; Arithmetique.ppcm(64, 72)</span>
<span class="sd"> 576</span>
<span class="sd"> :rtype: integer</span>
<span class="sd"> &quot;&quot;&quot;</span>
......@@ -206,7 +206,7 @@
</div>
<div class="viewcode-block" id="factoriseTex"><a class="viewcode-back" href="../../../pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.factoriseTex">[docs]</a><span class="k">def</span> <span class="nf">factoriseTex</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**factoriseTex**\ (*n*)</span>
<span class="sd">r&quot;&quot;&quot;**factoriseTex**\ (*n*)</span>
<span class="sd"> Retourne la liste des facteurs premiers du nombre n, ainsi que le détail de</span>
<span class="sd"> la factorisation au format TeX.</span>
......@@ -328,7 +328,7 @@
<span class="sd"> :type a,b: integer</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.outils import Arithmetique</span>
<span class="sd"> &gt;&gt;&gt; Arithmetique.valeur_alea(-7,7)</span>
<span class="sd"> &gt;&gt;&gt; Arithmetique.valeur_alea(-7,7) # doctest: +SKIP</span>
<span class="sd"> 2</span>
<span class="sd"> :rtype: integer</span>
......
......@@ -81,7 +81,7 @@
<span class="sd"> :type alpha: float</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.outils import Conversions</span>
<span class="sd"> &gt;&gt;&gt; Conversions.randians(30)</span>
<span class="sd"> &gt;&gt;&gt; Conversions.radians(30)</span>
<span class="sd"> 0.5235987755982988</span>
<span class="sd"> :rtype: float</span>
......
......@@ -79,6 +79,10 @@
</dl></dd>
<dt><a href="pyromaths.classes.PolynomesCollege.html#pyromaths.classes.PolynomesCollege.Polynome.__call__">__call__() (méthode pyromaths.classes.PolynomesCollege.Polynome)</a>
</dt>
<dt><a href="pyromaths.classes.Fractions.html#pyromaths.classes.Fractions.Fraction.__div__">__div__() (méthode pyromaths.classes.Fractions.Fraction)</a>
</dt>
......@@ -278,18 +282,14 @@
<dt><a href="pyromaths.outils.Priorites3.html#pyromaths.outils.Priorites3.effectue_calcul">effectue_calcul() (dans le module pyromaths.outils.Priorites3)</a>
</dt>
<dt><a href="pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.eratosthene">eratosthene() (dans le module pyromaths.outils.Arithmetique)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyromaths.outils.Priorites3.html#pyromaths.outils.Priorites3.EstNombre">EstNombre() (dans le module pyromaths.outils.Priorites3)</a>
<dt><a href="pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.eratosthene">eratosthene() (dans le module pyromaths.outils.Arithmetique)</a>
</dt>
<dt><a href="pyromaths.classes.PolynomesCollege.html#pyromaths.classes.PolynomesCollege.Polynome.evaluate">evaluate() (méthode pyromaths.classes.PolynomesCollege.Polynome)</a>
<dt><a href="pyromaths.outils.Priorites3.html#pyromaths.outils.Priorites3.EstNombre">EstNombre() (dans le module pyromaths.outils.Priorites3)</a>
</dt>
</dl></td>
......
......@@ -65,7 +65,7 @@ dénominateur.</p>
<dd><p>Cette classe crée la notion de fractions.
code permet de préciser si une décomposition a pour objectif une mise au
même dénominateur &#8216;r&#8217; ou une simplification &#8216;s&#8217;</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.Fractions.Fractions</span> <span class="kn">import</span> <span class="n">Fraction</span>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.classes.Fractions</span> <span class="kn">import</span> <span class="n">Fraction</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fraction</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">)</span>
<span class="go">Fraction(5, 6)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fraction</span><span class="p">(</span><span class="s">&#39;x&#39;</span><span class="p">,</span><span class="mi">6</span><span class="p">)</span>
......@@ -142,7 +142,7 @@ même dénominateur &#8216;r&#8217; ou une simplification &#8216;s&#8217;</p>
<p><tt class="docutils literal"><span class="pre">__invert__(p)</span></tt> est équivalent à <tt class="docutils literal"><span class="pre">~p</span></tt> calcule l&#8217;inverse de la fraction p.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.classes.Fractions</span> <span class="kn">import</span> <span class="n">Fraction</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">~</span><span class="n">Fraction</span><span class="p">(</span><span class="mi">8</span><span class="p">,</span><span class="mi">27</span><span class="p">)</span>
<span class="go">Fraction(27, 8, )</span>
<span class="go">Fraction(27, 8)</span>
</pre></div>
</div>
</dd></dl>
......
......@@ -83,12 +83,11 @@
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.outils</span> <span class="kn">import</span> <span class="n">Affichage</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.classes</span> <span class="kn">import</span> <span class="n">Fractions</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">=</span><span class="n">Fractions</span><span class="o">.</span><span class="n">Fraction</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">TeX</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
<span class="go">&#39;\dfrac{7}{3} &#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">TeX</span><span class="p">(</span><span class="n">f</span><span class="p">,</span><span class="n">fractex</span><span class="o">=</span><span class="s">&#39;</span><span class="se">\f</span><span class="s">rac&#39;</span><span class="p">)</span>
<span class="go">&#39;\frac{7}{3} &#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.classes.Fractions</span> <span class="kn">import</span> <span class="n">Fraction</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">TeX</span><span class="p">(</span><span class="n">Fraction</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span>
<span class="go">&#39;\\dfrac{7}{3} &#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">TeX</span><span class="p">(</span><span class="n">Fraction</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span><span class="mi">3</span><span class="p">),</span><span class="n">fractex</span><span class="o">=</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">frac&#39;</span><span class="p">)</span>
<span class="go">&#39;\\frac{7}{3} &#39;</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -153,15 +152,15 @@
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.outils</span> <span class="kn">import</span> <span class="n">Affichage</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">tex_coef</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;x&#39;</span><span class="p">)</span>
<span class="go">&#39;5\,x&#39;</span>
<span class="go">&#39;5\\,x&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">tex_coef</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;x&#39;</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="go">&#39;+5\,x&#39;</span>
<span class="go">&#39;+5\\,x&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">tex_coef</span><span class="p">(</span><span class="o">-</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;x&#39;</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="go">&#39;\left( -5\,x\right)&#39;</span>
<span class="go">&#39;\\left( -5\\,x\\right)&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">tex_coef</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;x&#39;</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="go">&#39;x&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Affichage</span><span class="o">.</span><span class="n">tex_coef</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;x&#39;</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="go">&#39;\left( 5\,x\right)&#39;</span>
<span class="go">&#39;\\left( 5\\,x\\right)&#39;</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......
......@@ -245,7 +245,7 @@ la factorisation au format TeX.</p>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.outils</span> <span class="kn">import</span> <span class="n">Arithmetique</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Arithmetique</span><span class="o">.</span><span class="n">factoriseTex</span><span class="p">(</span><span class="mi">2673</span><span class="p">)</span>
<span class="go">([3, 3, 3, 3, 3, 11], [&#39;\begin{align*}&#39;, &#39;2673&#39;, &#39; &amp; = 3 \times 891\\&#39;, &#39; &amp; = 3 \times 3 \times 297\\&#39;, &#39; &amp; = 3 \times 3 \times 3 \times 99\\&#39;, &#39; &amp; = 3 \times 3 \times 3 \times 3 \times 33\\&#39;, &#39; &amp; = 3 \times 3 \times 3 \times 3 \times 3 \times 11\\&#39;, &#39;\end{align*}&#39;])</span>
<span class="go">([3, 3, 3, 3, 3, 11], [&#39;\\begin{align*}&#39;, &#39;2673&#39;, &#39; &amp; = 3 \\times 891\\\\&#39;, &#39; &amp; = 3 \\times 3 \\times 297\\\\&#39;, &#39; &amp; = 3 \\times 3 \\times 3 \\times 99\\\\&#39;, &#39; &amp; = 3 \\times 3 \\times 3 \\times 3 \\times 33\\\\&#39;, &#39; &amp; = 3 \\times 3 \\times 3 \\times 3 \\times 3 \\times 11\\\\&#39;, &#39;\\end{align*}&#39;])</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -300,8 +300,8 @@ la factorisation au format TeX.</p>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.outils</span> <span class="kn">import</span> <span class="n">Arithmetique</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Arithmetique</span><span class="o">.</span><span class="n">ppcm</span><span class="p">(</span><span class="mi">64</span><span class="p">,</span><span class="mi">72</span><span class="p">)</span>
<span class="go">572</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Arithmetique</span><span class="o">.</span><span class="n">ppcm</span><span class="p">(</span><span class="mi">64</span><span class="p">,</span> <span class="mi">72</span><span class="p">)</span>
<span class="go">576</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -386,7 +386,7 @@ la factorisation au format TeX.</p>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.outils</span> <span class="kn">import</span> <span class="n">Arithmetique</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Arithmetique</span><span class="o">.</span><span class="n">valeur_alea</span><span class="p">(</span><span class="o">-</span><span class="mi">7</span><span class="p">,</span><span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Arithmetique</span><span class="o">.</span><span class="n">valeur_alea</span><span class="p">(</span><span class="o">-</span><span class="mi">7</span><span class="p">,</span><span class="mi">7</span><span class="p">)</span>
<span class="go">2</span>
</pre></div>
</div>
......
......@@ -99,7 +99,7 @@
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyromaths.outils</span> <span class="kn">import</span> <span class="n">Conversions</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Conversions</span><span class="o">.</span><span class="n">randians</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Conversions</span><span class="o">.</span><span class="n">radians</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
<span class="go">0.5235987755982988</span>
</pre></div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment