Commit 69e5d59f authored by Jérôme Ortais's avatar Jérôme Ortais
Browse files

Mise en conformité du code avec les classes Fractions et Polynomes

réécrites.
parent c02862f0
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 5f4625043df35602ee3ef5f504b3672b
tags: fbb0d17656682115ca4d033fb2f83ba1
config: 1db09c2b4581afc5efbcf75ed0223626
tags: 645f666f9bcd5a90fca523b33c5a78b7
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......@@ -8,11 +6,10 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vue d&#39;ensemble : code du module &mdash; Pyromaths 13.03 documentation</title>
<title>Vue d&#39;ensemble : code du module &mdash; documentation Pyromaths 13.03</title>
<link rel="stylesheet" href="../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/print.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
......@@ -28,12 +25,11 @@
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/translations.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../_static/theme_extras.js"></script>
<link rel="top" title="Pyromaths 13.03 documentation" href="../index.html" />
<link rel="top" title="documentation Pyromaths 13.03" href="../index.html" />
</head>
<body>
<div class="header"><img class="rightlogo" src="../_static/bandeau.png" alt="Logo"/><h1 class="heading"><a href="../index.html">
<span>Pyromaths 13.03 documentation</span></a></h1>
<span>documentation Pyromaths 13.03</span></a></h1>
<h2 class="heading"><span>Vue d&#39;ensemble : code du module</span></h2>
</div>
<div class="topnav">
......@@ -49,6 +45,7 @@
<h1>Modules pour lesquels le code est disponible</h1>
<ul><li><a href="pyromaths/classes/Fractions.html">pyromaths.classes.Fractions</a></li>
<li><a href="pyromaths/classes/PolynomesCollege.html">pyromaths.classes.PolynomesCollege</a></li>
<li><a href="pyromaths/ex/troisiemes/notion_de_fonction.html">pyromaths.ex.troisiemes.notion_de_fonction</a></li>
<li><a href="pyromaths/outils/Affichage.html">pyromaths.outils.Affichage</a></li>
<li><a href="pyromaths/outils/Arithmetique.html">pyromaths.outils.Arithmetique</a></li>
<li><a href="pyromaths/outils/Conversions.html">pyromaths.outils.Conversions</a></li>
......@@ -66,7 +63,7 @@
<div class="footer">
&copy; Copyright 2013, Jérôme Ortais.
Créé avec <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
Créé avec <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......@@ -8,11 +6,10 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pyromaths.outils.Affichage &mdash; Pyromaths 13.03 documentation</title>
<title>pyromaths.outils.Affichage &mdash; documentation Pyromaths 13.03</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/print.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
......@@ -28,13 +25,12 @@
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../../_static/theme_extras.js"></script>
<link rel="top" title="Pyromaths 13.03 documentation" href="../../../index.html" />
<link rel="top" title="documentation Pyromaths 13.03" href="../../../index.html" />
<link rel="up" title="Code du module" href="../../index.html" />
</head>
<body>
<div class="header"><img class="rightlogo" src="../../../_static/bandeau.png" alt="Logo"/><h1 class="heading"><a href="../../../index.html">
<span>Pyromaths 13.03 documentation</span></a></h1>
<span>documentation Pyromaths 13.03</span></a></h1>
<h2 class="heading"><span>pyromaths.outils.Affichage</span></h2>
</div>
<div class="topnav">
......@@ -195,7 +191,7 @@
<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">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="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="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">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>
......@@ -242,7 +238,7 @@
<div class="footer">
&copy; Copyright 2013, Jérôme Ortais.
Créé avec <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
Créé avec <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......@@ -8,11 +6,10 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pyromaths.outils.Arithmetique &mdash; Pyromaths 13.03 documentation</title>
<title>pyromaths.outils.Arithmetique &mdash; documentation Pyromaths 13.03</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/print.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
......@@ -28,13 +25,12 @@
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../../_static/theme_extras.js"></script>
<link rel="top" title="Pyromaths 13.03 documentation" href="../../../index.html" />
<link rel="top" title="documentation Pyromaths 13.03" href="../../../index.html" />
<link rel="up" title="Code du module" href="../../index.html" />
</head>
<body>
<div class="header"><img class="rightlogo" src="../../../_static/bandeau.png" alt="Logo"/><h1 class="heading"><a href="../../../index.html">
<span>Pyromaths 13.03 documentation</span></a></h1>
<span>documentation Pyromaths 13.03</span></a></h1>
<h2 class="heading"><span>pyromaths.outils.Arithmetique</span></h2>
</div>
<div class="topnav">
......@@ -73,39 +69,58 @@
<span class="kn">import</span> <span class="nn">math</span><span class="o">,</span> <span class="nn">random</span>
<div class="viewcode-block" id="pgcd"><a class="viewcode-back" href="../../../pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.pgcd">[docs]</a><span class="k">def</span> <span class="nf">pgcd</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**pgcd**\ (*a*\ , *b*\ )</span>
<div class="viewcode-block" id="pgcd"><a class="viewcode-back" href="../../../pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.pgcd">[docs]</a><span class="k">def</span> <span class="nf">pgcd</span><span class="p">(</span><span class="o">*</span><span class="n">n</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**pgcd**\ (*n*)</span>
<span class="sd"> Calcule le pgcd de deux entiers.</span>
<span class="sd"> Calcule le pgcd de plusieurs entiers entiers.</span>
<span class="sd"> </span>
<span class="sd"> Merci à http://python.jpvweb.com/mesrecettespython/doku.php?id=pgcd_ppcm</span>
<span class="sd"> :param a,b: Les entiers dont on veut le pgcd</span>
<span class="sd"> :type a,b: integer</span>
<span class="sd"> :param n: Les entiers dont on veut le pgcd</span>
<span class="sd"> :type n: integer</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.outils import Arithmetique</span>
<span class="sd"> &gt;&gt;&gt; Arithmetique.pgcd(64,72)</span>
<span class="sd"> 8</span>
<span class="sd"> &gt;&gt;&gt; Arithmetique.pgcd(64,72,36)</span>
<span class="sd"> 4</span>
<span class="sd"> :rtype: integer</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">while</span> <span class="n">b</span><span class="p">:</span>
<span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">b</span><span class="p">,</span> <span class="n">a</span> <span class="o">%</span> <span class="n">b</span>
<span class="k">return</span> <span class="n">a</span>
<span class="k">def</span> <span class="nf">_pgcd</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
<span class="c">#=======================================================================</span>
<span class="c"># print &quot;pgcd dans arithmetique &quot;, a, b, isinstance(a, int), isinstance(b, int)</span>
<span class="c"># print repr(a), repr(b)</span>
<span class="c">#=======================================================================</span>
<span class="k">if</span> <span class="nb">abs</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s">&#39;inf&#39;</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">abs</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s">&#39;inf&#39;</span><span class="p">):</span> <span class="k">return</span> <span class="mi">1</span>
<span class="k">while</span> <span class="n">b</span><span class="p">:</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">b</span><span class="p">,</span> <span class="n">a</span> <span class="o">%</span> <span class="n">b</span>
<span class="k">return</span> <span class="n">a</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">_pgcd</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">n</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">n</span><span class="p">[</span><span class="mi">2</span><span class="p">:]:</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">_pgcd</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="k">return</span> <span class="n">p</span>
</div>
<div class="viewcode-block" id="ppcm"><a class="viewcode-back" href="../../../pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.ppcm">[docs]</a><span class="k">def</span> <span class="nf">ppcm</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**ppcm**\ (*a*\ , *b*\ )</span>
<div class="viewcode-block" id="ppcm"><a class="viewcode-back" href="../../../pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.ppcm">[docs]</a><span class="k">def</span> <span class="nf">ppcm</span><span class="p">(</span><span class="o">*</span><span class="n">n</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**ppcm**\ (*n*)</span>
<span class="sd"> Calcule le ppcm de deux entiers.</span>
<span class="sd"> Calcule le ppcm de plusieurs entiers.</span>
<span class="sd"> </span>
<span class="sd"> Merci à http://python.jpvweb.com/mesrecettespython/doku.php?id=pgcd_ppcm</span>
<span class="sd"> :param a,b: Les entiers dont on veut le ppcm</span>
<span class="sd"> :type a,b: integer</span>
<span class="sd"> :param n: Les entiers dont on veut le ppcm</span>
<span class="sd"> :type n: 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"> &gt;&gt;&gt; Arithmetique.ppcm(64, 72, 36)</span>
<span class="sd"> 576</span>
<span class="sd"> :rtype: integer</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span> <span class="o">/</span> <span class="n">pgcd</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_pgcd</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
<span class="k">while</span> <span class="n">b</span><span class="p">:</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">b</span><span class="p">,</span> <span class="n">a</span> <span class="o">%</span> <span class="n">b</span>
<span class="k">return</span> <span class="n">a</span>
<span class="n">p</span> <span class="o">=</span> <span class="nb">abs</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="n">n</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="o">//</span> <span class="n">_pgcd</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">n</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">n</span><span class="p">[</span><span class="mi">2</span><span class="p">:]:</span>
<span class="n">p</span> <span class="o">=</span> <span class="nb">abs</span><span class="p">(</span><span class="n">p</span> <span class="o">*</span> <span class="n">x</span><span class="p">)</span> <span class="o">//</span> <span class="n">_pgcd</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="k">return</span> <span class="n">p</span>
</div>
<div class="viewcode-block" id="premier"><a class="viewcode-back" href="../../../pyromaths.outils.Arithmetique.html#pyromaths.outils.Arithmetique.premier">[docs]</a><span class="k">def</span> <span class="nf">premier</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;**premier**\ (*n*)</span>
......@@ -382,7 +397,7 @@
<div class="footer">
&copy; Copyright 2013, Jérôme Ortais.
Créé avec <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
Créé avec <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......@@ -8,11 +6,10 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pyromaths.outils.Conversions &mdash; Pyromaths 13.03 documentation</title>
<title>pyromaths.outils.Conversions &mdash; documentation Pyromaths 13.03</title>
<link rel="stylesheet" href="../../../_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/print.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
......@@ -28,13 +25,12 @@
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/translations.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../../_static/theme_extras.js"></script>
<link rel="top" title="Pyromaths 13.03 documentation" href="../../../index.html" />
<link rel="top" title="documentation Pyromaths 13.03" href="../../../index.html" />
<link rel="up" title="Code du module" href="../../index.html" />
</head>
<body>
<div class="header"><img class="rightlogo" src="../../../_static/bandeau.png" alt="Logo"/><h1 class="heading"><a href="../../../index.html">
<span>Pyromaths 13.03 documentation</span></a></h1>
<span>documentation Pyromaths 13.03</span></a></h1>
<h2 class="heading"><span>pyromaths.outils.Conversions</span></h2>
</div>
<div class="topnav">
......@@ -117,7 +113,7 @@
<div class="footer">
&copy; Copyright 2013, Jérôme Ortais.
Créé avec <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
Créé avec <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
\ No newline at end of file
......@@ -17,6 +17,7 @@ Contenu :
intro.rst
pyromaths.classes.rst
pyromaths.outils.rst
pyromaths.ex.troisiemes.rst
......
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