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

Dans Priorites3, remplace toute fraction de dénominateur 1 par un entier

en gérant les parenthèses dans le cas d'un entier négatif.
parent 82b63fbd
......@@ -580,6 +580,7 @@
<span class="sd"> * les produits au numérateur et dénominateur sont effectuée dans les sommes et différences de fractions</span>
<span class="sd"> * les produits au numérateur et dénominateur sont simplifiés sinon</span>
<span class="sd"> * les fractions de dénominateur 1 sont changées en entier</span>
<span class="sd"> :param calcul: le calcul à traiter</span>
<span class="sd"> :type calcul: list</span>
......@@ -587,8 +588,8 @@
<span class="sd"> :type final: boolean</span>
<span class="sd"> &gt;&gt;&gt; from pyromaths.classes.PolynomesCollege import Polynome</span>
<span class="sd"> &gt;&gt;&gt; Priorites3.post_fractions([&#39;Fraction(3*4, 2*4, &quot;r&quot;) + Fraction(5, 8)&#39;])</span>
<span class="sd"> [&#39;Fraction(12, 8) + Fraction(5, 8)&#39;]</span>
<span class="sd"> &gt;&gt;&gt; Priorites3.post_fractions([&#39;Fraction(3*4, 2*4, &quot;r&quot;)&#39;, &#39;+&#39;, &#39;Fraction(5, 8)&#39;])</span>
<span class="sd"> [&#39;Fraction(12, 8)&#39;, &#39;+&#39;, &#39;Fraction(5, 8)&#39;]</span>
<span class="sd"> &gt;&gt;&gt; Priorites3.post_fractions([&#39;Fraction(3*4*5, 2*4, &quot;s&quot;)&#39;])</span>
<span class="sd"> [&#39;Fraction(15, 2)&#39;]</span>
......@@ -606,7 +607,8 @@
<span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">return</span> <span class="n">e</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">for</span> <span class="n">k</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">e</span><span class="p">)):</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">while</span> <span class="n">k</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">e</span><span class="p">):</span>
<span class="n">index</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">while</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="ow">and</span> <span class="s">&#39;Fraction(&#39;</span> <span class="ow">in</span> <span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">index</span><span class="p">:]:</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s">&#39;Fraction(&#39;</span><span class="p">,</span> <span class="n">index</span><span class="p">)</span>
......@@ -616,7 +618,20 @@
<span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">][:</span><span class="n">index</span><span class="p">]</span> <span class="o">+</span> <span class="nb">repr</span><span class="p">(</span><span class="n">Fraction</span><span class="o">.</span><span class="n">simplifie</span><span class="p">(</span><span class="n">frac</span><span class="p">))</span> <span class="o">+</span> <span class="n">splitted</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">frac</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">e</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">][:</span><span class="n">index</span><span class="p">]</span> <span class="o">+</span> <span class="nb">repr</span><span class="p">(</span><span class="n">Fraction</span><span class="o">.</span><span class="n">reduit</span><span class="p">(</span><span class="n">frac</span><span class="p">))</span> <span class="o">+</span> <span class="n">splitted</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">frac</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="k">if</span> <span class="n">frac</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="k">if</span> <span class="n">k</span> <span class="ow">and</span> <span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;+&#39;</span><span class="p">:</span>
<span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;-&#39;</span>
<span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">frac</span><span class="o">.</span><span class="n">n</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">e</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">k</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;)&#39;</span><span class="p">)</span>
<span class="n">e</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">k</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">frac</span><span class="o">.</span><span class="n">n</span><span class="p">))</span>
<span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;(&#39;</span>
<span class="n">k</span><span class="o">+=</span><span class="mi">2</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">e</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">frac</span><span class="o">.</span><span class="n">n</span><span class="p">)</span>
<span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="n">k</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">index</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">while</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">e</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="ow">and</span> <span class="s">&#39;Fraction(&#39;</span> <span class="ow">in</span> <span class="n">e</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">index</span><span class="p">:]:</span>
......
......@@ -248,6 +248,7 @@ supérieure ou égale à min_i, sans expression régulière.</p>
<ul class="simple">
<li>les produits au numérateur et dénominateur sont effectuée dans les sommes et différences de fractions</li>
<li>les produits au numérateur et dénominateur sont simplifiés sinon</li>
<li>les fractions de dénominateur 1 sont changées en entier</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
......@@ -262,8 +263,8 @@ supérieure ou égale à min_i, sans expression régulière.</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.classes.PolynomesCollege</span> <span class="kn">import</span> <span class="n">Polynome</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Priorites3</span><span class="o">.</span><span class="n">post_fractions</span><span class="p">([</span><span class="s">&#39;Fraction(3*4, 2*4, &quot;r&quot;) + Fraction(5, 8)&#39;</span><span class="p">])</span>
<span class="go">[&#39;Fraction(12, 8) + Fraction(5, 8)&#39;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Priorites3</span><span class="o">.</span><span class="n">post_fractions</span><span class="p">([</span><span class="s">&#39;Fraction(3*4, 2*4, &quot;r&quot;)&#39;</span><span class="p">,</span> <span class="s">&#39;+&#39;</span><span class="p">,</span> <span class="s">&#39;Fraction(5, 8)&#39;</span><span class="p">])</span>
<span class="go">[&#39;Fraction(12, 8)&#39;, &#39;+&#39;, &#39;Fraction(5, 8)&#39;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Priorites3</span><span class="o">.</span><span class="n">post_fractions</span><span class="p">([</span><span class="s">&#39;Fraction(3*4*5, 2*4, &quot;s&quot;)&#39;</span><span class="p">])</span>
<span class="go">[&#39;Fraction(15, 2)&#39;]</span>
</pre></div>
......
Search.setIndex({objects:{"pyromaths.classes.Fractions.Fraction":{"__invert__":[3,1,1,""],"__rdiv__":[3,1,1,""],"__str__":[3,1,1,""],"__neg__":[3,1,1,""],"__radd__":[3,1,1,""],"__pos__":[3,1,1,""],"__div__":[3,1,1,""],"__mul__":[3,1,1,""],"__rsub__":[3,1,1,""],"__repr__":[3,1,1,""],"__add__":[3,1,1,""],simplifie:[3,1,1,""],"__rmul__":[3,1,1,""],"__sub__":[3,1,1,""],reduit:[3,1,1,""],decompose:[3,1,1,""],"__pow__":[3,1,1,""]},"pyromaths.outils.Arithmetique":{ppcm:[1,2,1,""],signe:[1,2,1,""],factorise:[1,2,1,""],valeur_alea:[1,2,1,""],premier:[1,2,1,""],factoriseTex:[1,2,1,""],pgcd:[1,2,1,""],factor:[1,2,1,""],combinaison:[1,2,1,""],ecrit_tex:[1,2,1,""],carrerise:[1,2,1,""],eratosthene:[1,2,1,""]},"pyromaths.outils.Priorites3":{recherche_fin_operation:[2,2,1,""],recherche_puissance:[2,2,1,""],cherche_classe:[2,2,1,""],post_fractions:[2,2,1,""],recherche_operation:[2,2,1,""],recherche_neg:[2,2,1,""],splitting:[2,2,1,""],priorites:[2,2,1,""],split_calcul:[2,2,1,""],cherche_decimal:[2,2,1,""],post_polynomes:[2,2,1,""],recherche_parentheses:[2,2,1,""],recherche_somme:[2,2,1,""],recherche_produit:[2,2,1,""],EstNombre:[2,2,1,""],cherche_operateur:[2,2,1,""],texify:[2,2,1,""],effectue_calcul:[2,2,1,""]},"pyromaths.outils.Affichage":{pTeX:[6,2,1,""],TeXz:[6,2,1,""],tTeX:[6,2,1,""],TeX:[6,2,1,""],fTeX:[6,2,1,""],tex_coef:[6,2,1,""]},"pyromaths.classes.PolynomesCollege.Polynome":{"__str__":[5,1,1,""],"__radd__":[5,1,1,""],"__rsub__":[5,1,1,""],"__rmul__":[5,1,1,""],"__init__":[5,1,1,""],"__pos__":[5,1,1,""],reduction_detaillee:[5,1,1,""],"__call__":[5,1,1,""],reductible:[5,1,1,""],"__len__":[5,1,1,""],"__neg__":[5,1,1,""],"__ne__":[5,1,1,""],"__getitem__":[5,1,1,""],"__pow__":[5,1,1,""],"__add__":[5,1,1,""],ordonne:[5,1,1,""],"__eq__":[5,1,1,""],"__iadd__":[5,1,1,""],degre:[5,1,1,""],"__mul__":[5,1,1,""],"__repr__":[5,1,1,""],"__sub__":[5,1,1,""],reduit:[5,1,1,""]},"pyromaths.outils.Conversions":{degres:[7,2,1,""],radians:[7,2,1,""]},"pyromaths.classes.Fractions":{Fraction:[3,3,1,""]},"pyromaths.classes.PolynomesCollege":{Polynome:[5,3,1,""]},"pyromaths.classes":{Fractions:[3,0,1,""]},"pyromaths.outils":{Conversions:[7,0,1,""],Arithmetique:[1,0,1,""],Priorites3:[2,0,1,""],Affichage:[6,0,1,""]}},terms:{essay:0,code:[0,3],valeur_alea:1,"polyn\u00f4m":[0,8,5,2],skip:1,"d\u00e9j\u00e0":[0,2],veut:1,"\u00e9gaux":5,"\u00e9tape":2,"d\u00e9compos":1,interdit:5,"__str__":[5,3],objet:[5,2,3],"irr\u00e9duct":3,sourc:[1,5,2,6,7,3],string:[6,5,2,1,3],prendr:2,fals:[5,2,1,6],end:1,sont:[0,5,2],voir:3,"pr\u00e9c\u00e9d\u00e9":2,list:[5,2,1],effectue_calcul:2,"r\u00e9duit":[5,2,3],"r\u00e9duir":5,sign:[2,1,6],tex:[2,1,6],"__rmul__":[5,3],entr:1,permett:5,fonction:[0,1,5,2,6,7,8,9],index:[0,2],"pr\u00e9c\u00e9d\u00e9e":2,renvoi:[5,3],"\u00e9l\u00e9ment":[5,1],version:[5,3],sur:5,gagner:2,cela:2,"diff\u00e9renc":[2,3],supprim:1,coeffici:[5,6],len:5,valu:2,"m\u00eame":3,convers:[0,7,9],doctest:1,"d\u00e9cimal":[2,6],entier:[2,1,3],action:5,changer:6,quotient:3,l_interdit:2,parmi:1,modul:[0,1,2,6,5,3,7],"\u00e9quival":[5,3],"boolean":[5,2,1,6],"num\u00e9rateur":[2,3],"arithm\u00e9tiqu":[0,1,9],combinaison:1,rationnel:[0,6,8,3],from:[1,5,2,6,7,3],doubl:6,formul:[5,1],type:[1,5,2,6,7,3],"\u00e9quivaut":5,affichag:[0,9,2,6],"diff\u00e9rent":5,tester:[2,1],"utilis\u00e9":5,moin:5,none:[5,1],devant:6,pour:[0,1,2,6,5,3],"g\u00e9rer":2,tabul:1,abord:5,objectif:[0,2,3],dfrac:[6,5,3],construit:[5,3],partitionn:2,"d\u00e9taillant":2,bienvenu:0,liter:[1,5,2,6,7,3],tab:1,suivant:5,occur:2,multipl:[5,2],divis:2,"__pos__":[5,3],"fa\u00e7on":2,recherche_oper:2,"parenth\u00e8s":[2,6],"op\u00e9rand":2,sinon:[5,2,1],carreris:1,attent:3,"d\u00e9nominateur":[2,3],permet:[6,5,3],"situ\u00e9":2,avant:2,raccourci:6,ensembl:[2,1],factorisetex:1,reduit:[5,3],"d\u00e9faut":6,cadr:1,peut:[5,2,3],"d\u00e9velopp\u00e9":0,"__rdiv__":3,afin:[0,2,3],nombr:[0,1,2,6,5,3,8],"r\u00e9el":[2,3],style:2,pens:2,p__pow__:3,soustract:2,infini:6,"op\u00e9rat":2,fin:2,tex_coef:6,split:2,non:[2,1],"__getitem__":5,dan:[0,5,2,1],"\u00e9galement":2,effectu:[5,2],autr:5,"__pow__":[5,3],introduct:[0,4],term:6,"d\u00e9taill\u00e9":[5,2,3],debut:2,ordr:5,entour:1,compris:1,"oppos\u00e9":[5,2,3],cett:[5,2,3],"int\u00e9rieur":2,"cr\u00e9er":[6,5,3],frac:6,todo:[5,2,1,3],reduct:5,"\u00e9crivant":5,variabl:[5,6],respectiv:5,"d\u00e9but":2,contenu:[0,2],valeur:[5,2,1],bplu:6,occurr:2,math:7,"r\u00e9ductibl":5,pui:2,coef:6,post_polynom:2,compri:2,que:[2,1],factoris:[5,1],dire:2,qui:[5,2,3],indent:1,angl:7,texifi:2,place:3,"entour\u00e9":2,degr:[7,5],dont:[5,1],mise:3,affich:6,"inf\u00e9rieur":1,"\u00e9crire":[1,6],"\u00e8me":5,"effectu\u00e9":2,donn:3,avec:[6,5,2,3],"final":2,racinedegre2:6,parc:5,ainsi:1,recherch:[0,2],"num\u00e9riqu":5,produit:[6,5,2,3],"repr\u00e9sent":[5,3],str:[5,3],posit:2,arrang:2,pre:[1,5,2,6,7,3],san:2,"carr\u00e9":1,premier:[5,2,1],pri:1,"__radd__":[5,3],"retourn\u00e9":[1,5,2,6,7,3],faut:[1,6],devrai:2,ftex:6,"null":1,"priorit\u00e9":2,form:5,"\u00e9ventuel":2,self:[5,3],deux:[5,2,1,3],recherche_puiss:2,suivi:2,dernier:[5,2],simplifi:[2,3],begin:1,multipli:1,object:[5,3],doit:2,compt:5,alpha:7,"class":[0,1,2,6,5,3,7,8],charg:2,latex:[5,1,3],"\u00e9crit":[5,1],simplif:3,corrig:[5,3],notion:[5,3],"n\u00e9cessair":[5,2],texz:6,ajout:6,arithmetiqu:[0,1,9],fini:2,radic:6,"lisibilit\u00e9":5,fichier:1,priorites3:[0,2,9],ptex:6,quel:0,choisi:5,estnombr:2,factor:1,"__call__":5,analys:2,"\u00e9tablit":1,express:[0,5,2,9],repr:[5,3],cherche_class:2,recherche_somm:2,trouver:2,"import":[1,5,2,6,7,3],ecrit_tex:1,thenocalcul:1,ordonn:5,monom:5,partir:[5,2,3],mettr:6,"d\u00e9veloppeur":0,"caract\u00e8r":[5,2,3],fait:6,fair:[5,3],"cr\u00e9e":[5,3],automatiqu:1,decompos:3,recherche_parenthes:2,nul:[5,2],particip:0,rendr:1,"\u00e9gale":[5,2],pyromath:[0,1,2,6,5,3,7,8,9],facteur:1,comm:5,polynomescolleg:[0,8,5,2],vrai:6,addit:2,"d\u00e9tail":[1,3],positif:[1,6],ell:[5,2],alor:[5,6],tout:[5,2],aura:1,"ins\u00e9rer":1,autour:6,point:5,pow:5,devrait:5,"g\u00e8re":6,quatriem:1,"__rsub__":[5,3],cancel:3,respect:2,outil:[0,1,2,6,7,9],invers:3,tient:5,"__len__":5,"distributivit\u00e9":5,restant:2,"\u00e9critur":[6,2,3],"identit\u00e9":5,laquel:2,rang:5,"__eq__":5,emploi:6,align:1,"__iadd__":5,calcul:[5,2,1,3],"__sub__":[5,3],devra:2,puissanc:[6,5,2,3],recherche_neg:2,fractionnair:3,conten:[5,2],raison:5,"__init__":5,par:[6,5,2,1,3],"pr\u00e9ciser":3,"d\u00e9pendant":5,parti:6,min_i:2,traiter:2,document:0,"__repr__":[5,3],ppcm:1,"__add__":[5,3],"\u00e9valuat":[0,2,9],"bin\u00f4m":5,"modifi\u00e9":5,"encha\u00een":2,calculatoir:[0,2,9],"r\u00e9cup\u00e9rer":2,parenthes:6,lequel:1,"__div__":3,cet:2,command:6,"__neg__":[5,3],left:[2,6],remarqu:5,newton:5,obtenir:[2,1],rapid:2,expos:2,"\u00e9t\u00e9":1,priorit:2,param:[5,3],exempl:2,real:3,combien:1,format:[2,1,6],post_fract:2,racin:2,"d\u00e9finit":[1,3],bpc:6,docutil:[1,5,2,6,7,3],integ:[6,5,2,1,3],bpn:6,recherche_fin_oper:2,page:0,"degr\u00e9":[7,5,6],"corrig\u00e9":1,multipla:2,right:[2,6],somm:[6,5,2,3],"mon\u00f4m":[5,6],born:1,polynom:[5,2],convertit:[7,2],"int\u00e9grer":2,est:[6,5,2,1,3],sachant:0,"\u00e9valuabl":[5,3],avoir:2,foi:[5,2],radian:7,"premi\u00e8r":2,"__ne__":5,plu:[2,1,3],split_calcul:2,cherche_decim:2,"\u00eatre":[5,2,3],permettr:0,pgcd:1,"__mul__":[5,3],"11_":3,"donn\u00e9":7,"num\u00e9rot":1,"v\u00e9rifier":2,"float":[7,5,1],son:3,sou:6,retourn:[5,2,1,3],"72_":3,"n\u00e9gatif":6,span:[1,5,2,6,7,3],avenir:2,fraction:[0,2,6,5,3,8],suit:[5,2],"var":[5,6],"__invert__":3,tupl:[2,1],fractex:6,"\u00e9quation":1,inclu:2,"true":[5,2,6],bug:5,temp:2,maximum:0,recherche_produit:2,"cha\u00een":[5,2,3],"simplifi\u00e9":2,constant:5,chercher:2,petit:1,utilis:[5,2,6],"op\u00e9rateur":2,"v\u00e9rifiant":2,eratosthen:1,cherche_operateur:2,"pr\u00e9c\u00e9dent":5,other:[5,3],test:[2,1],introduit:5,"r\u00e9guli\u00e8r":2,liste_calcul:2,developp:1,reduction_detaille:5,"sup\u00e9rieur":[5,2,1],"ordonn\u00e9":[5,2],"param\u00e8tr":[1,5,2,6,7,3],ttex:6,"d\u00e9velopp":[0,5],ignor:2,time:[1,3],"d\u00e9composit":3},objtypes:{"0":"py:module","1":"py:method","2":"py:function","3":"py:class"},titles:["Bienvenue dans la documentation de Pyromaths !","3.2. <tt class=\"docutils literal\"><span class=\"pre\">Arithmetique</span></tt> &#8212; Fonctions arithm\u00e9tiques","3.4. <tt class=\"docutils literal\"><span class=\"pre\">Priorites3</span></tt> &#8212; \u00c9valuation d&#8217;une expression calculatoire","2.1. <tt class=\"docutils literal\"><span class=\"pre\">Fractions</span></tt> &#8212; Nombres rationnels","1. Introduction","2.2. <tt class=\"docutils literal\"><span class=\"pre\">PolynomesCollege</span></tt> &#8212; Fonctions polyn\u00f4mes","3.1. <tt class=\"docutils literal\"><span class=\"pre\">Affichage</span></tt> &#8212; Fonctions d&#8217;affichage","3.3. <tt class=\"docutils literal\"><span class=\"pre\">Conversions</span></tt> &#8212; Fonctions de conversions","2. Les classes de Pyromaths","3. Les outils de Pyromaths"],objnames:{"0":["py","module","Python module"],"1":["py","method","Python m\u00e9thode"],"2":["py","function","Python fonction"],"3":["py","class","Python classe"]},filenames:["index","pyromaths.outils.Arithmetique","pyromaths.outils.Priorites3","pyromaths.classes.Fractions","intro","pyromaths.classes.PolynomesCollege","pyromaths.outils.Affichage","pyromaths.outils.Conversions","pyromaths.classes","pyromaths.outils"]})
\ No newline at end of file
Search.setIndex({objects:{"pyromaths.classes.Fractions.Fraction":{"__invert__":[3,1,1,""],"__rdiv__":[3,1,1,""],"__str__":[3,1,1,""],"__neg__":[3,1,1,""],"__radd__":[3,1,1,""],"__pos__":[3,1,1,""],"__div__":[3,1,1,""],"__mul__":[3,1,1,""],"__rsub__":[3,1,1,""],"__repr__":[3,1,1,""],"__add__":[3,1,1,""],simplifie:[3,1,1,""],"__rmul__":[3,1,1,""],"__sub__":[3,1,1,""],reduit:[3,1,1,""],decompose:[3,1,1,""],"__pow__":[3,1,1,""]},"pyromaths.outils.Arithmetique":{ppcm:[1,2,1,""],signe:[1,2,1,""],factorise:[1,2,1,""],valeur_alea:[1,2,1,""],premier:[1,2,1,""],factoriseTex:[1,2,1,""],pgcd:[1,2,1,""],factor:[1,2,1,""],combinaison:[1,2,1,""],ecrit_tex:[1,2,1,""],carrerise:[1,2,1,""],eratosthene:[1,2,1,""]},"pyromaths.outils.Priorites3":{recherche_fin_operation:[2,2,1,""],recherche_puissance:[2,2,1,""],cherche_classe:[2,2,1,""],post_fractions:[2,2,1,""],recherche_operation:[2,2,1,""],recherche_neg:[2,2,1,""],splitting:[2,2,1,""],priorites:[2,2,1,""],split_calcul:[2,2,1,""],cherche_decimal:[2,2,1,""],post_polynomes:[2,2,1,""],recherche_parentheses:[2,2,1,""],recherche_somme:[2,2,1,""],recherche_produit:[2,2,1,""],EstNombre:[2,2,1,""],cherche_operateur:[2,2,1,""],texify:[2,2,1,""],effectue_calcul:[2,2,1,""]},"pyromaths.outils.Affichage":{pTeX:[6,2,1,""],TeXz:[6,2,1,""],tTeX:[6,2,1,""],TeX:[6,2,1,""],fTeX:[6,2,1,""],tex_coef:[6,2,1,""]},"pyromaths.classes.PolynomesCollege.Polynome":{"__str__":[5,1,1,""],"__radd__":[5,1,1,""],"__rsub__":[5,1,1,""],"__rmul__":[5,1,1,""],"__init__":[5,1,1,""],"__pos__":[5,1,1,""],reduction_detaillee:[5,1,1,""],"__call__":[5,1,1,""],reductible:[5,1,1,""],"__len__":[5,1,1,""],"__neg__":[5,1,1,""],"__ne__":[5,1,1,""],"__getitem__":[5,1,1,""],"__pow__":[5,1,1,""],"__add__":[5,1,1,""],ordonne:[5,1,1,""],"__eq__":[5,1,1,""],"__iadd__":[5,1,1,""],degre:[5,1,1,""],"__mul__":[5,1,1,""],"__repr__":[5,1,1,""],"__sub__":[5,1,1,""],reduit:[5,1,1,""]},"pyromaths.outils.Conversions":{degres:[7,2,1,""],radians:[7,2,1,""]},"pyromaths.classes.Fractions":{Fraction:[3,3,1,""]},"pyromaths.classes.PolynomesCollege":{Polynome:[5,3,1,""]},"pyromaths.classes":{Fractions:[3,0,1,""]},"pyromaths.outils":{Conversions:[7,0,1,""],Arithmetique:[1,0,1,""],Priorites3:[2,0,1,""],Affichage:[6,0,1,""]}},terms:{essay:0,code:[0,3],valeur_alea:1,"polyn\u00f4m":[0,8,5,2],skip:1,"d\u00e9j\u00e0":[0,2],veut:1,"\u00e9gaux":5,"\u00e9tape":2,"d\u00e9compos":1,interdit:5,"__str__":[5,3],objet:[5,2,3],"irr\u00e9duct":3,sourc:[1,5,2,6,7,3],string:[6,5,2,1,3],prendr:2,fals:[5,2,1,6],end:1,"chang\u00e9":2,sont:[0,5,2],voir:3,"pr\u00e9c\u00e9d\u00e9":2,list:[5,2,1],effectue_calcul:2,"r\u00e9duit":[5,2,3],"r\u00e9duir":5,sign:[2,1,6],tex:[2,1,6],"__rmul__":[5,3],entr:1,permett:5,fonction:[0,1,5,2,6,7,8,9],index:[0,2],"pr\u00e9c\u00e9d\u00e9e":2,renvoi:[5,3],"\u00e9l\u00e9ment":[5,1],version:[5,3],sur:5,gagner:2,cela:2,"diff\u00e9renc":[2,3],supprim:1,coeffici:[5,6],len:5,valu:2,"m\u00eame":3,convers:[0,7,9],doctest:1,"d\u00e9cimal":[2,6],entier:[2,1,3],action:5,changer:6,quotient:3,l_interdit:2,parmi:1,modul:[0,1,2,6,5,3,7],"\u00e9quival":[5,3],"boolean":[5,2,1,6],"num\u00e9rateur":[2,3],"arithm\u00e9tiqu":[0,1,9],combinaison:1,rationnel:[0,6,8,3],from:[1,5,2,6,7,3],doubl:6,formul:[5,1],type:[1,5,2,6,7,3],"\u00e9quivaut":5,affichag:[0,9,2,6],"diff\u00e9rent":5,tester:[2,1],"utilis\u00e9":5,moin:5,none:[5,1],devant:6,pour:[0,1,2,6,5,3],"g\u00e9rer":2,tabul:1,abord:5,objectif:[0,2,3],dfrac:[6,5,3],construit:[5,3],partitionn:2,"d\u00e9taillant":2,bienvenu:0,liter:[1,5,2,6,7,3],tab:1,suivant:5,occur:2,multipl:[5,2],divis:2,"__pos__":[5,3],"fa\u00e7on":2,recherche_oper:2,"parenth\u00e8s":[2,6],"op\u00e9rand":2,sinon:[5,2,1],carreris:1,attent:3,"d\u00e9nominateur":[2,3],permet:[6,5,3],"situ\u00e9":2,avant:2,raccourci:6,ensembl:[2,1],factorisetex:1,reduit:[5,3],"d\u00e9faut":6,cadr:1,peut:[5,2,3],"d\u00e9velopp\u00e9":0,"__rdiv__":3,afin:[0,2,3],nombr:[0,1,2,6,5,3,8],"r\u00e9el":[2,3],style:2,pens:2,p__pow__:3,soustract:2,infini:6,"op\u00e9rat":2,fin:2,tex_coef:6,split:2,non:[2,1],"__getitem__":5,dan:[0,5,2,1],"\u00e9galement":2,effectu:[5,2],autr:5,"__pow__":[5,3],introduct:[0,4],term:6,"d\u00e9taill\u00e9":[5,2,3],debut:2,ordr:5,entour:1,compris:1,"oppos\u00e9":[5,2,3],cett:[5,2,3],"int\u00e9rieur":2,"cr\u00e9er":[6,5,3],frac:6,todo:[5,2,1,3],reduct:5,"\u00e9crivant":5,variabl:[5,6],respectiv:5,"d\u00e9but":2,contenu:[0,2],valeur:[5,2,1],bplu:6,occurr:2,math:7,"r\u00e9ductibl":5,pui:2,coef:6,post_polynom:2,compri:2,que:[2,1],factoris:[5,1],dire:2,qui:[5,2,3],indent:1,angl:7,texifi:2,place:3,"entour\u00e9":2,degr:[7,5],dont:[5,1],mise:3,affich:6,"inf\u00e9rieur":1,"\u00e9crire":[1,6],"\u00e8me":5,"effectu\u00e9":2,donn:3,avec:[6,5,2,3],"final":2,racinedegre2:6,parc:5,ainsi:1,recherch:[0,2],"num\u00e9riqu":5,produit:[6,5,2,3],"repr\u00e9sent":[5,3],str:[5,3],posit:2,arrang:2,pre:[1,5,2,6,7,3],san:2,"carr\u00e9":1,premier:[5,2,1],pri:1,"__radd__":[5,3],"retourn\u00e9":[1,5,2,6,7,3],faut:[1,6],devrai:2,ftex:6,"null":1,"priorit\u00e9":2,form:5,"\u00e9ventuel":2,self:[5,3],deux:[5,2,1,3],recherche_puiss:2,suivi:2,dernier:[5,2],simplifi:[2,3],begin:1,multipli:1,object:[5,3],doit:2,compt:5,alpha:7,"class":[0,1,2,6,5,3,7,8],charg:2,latex:[5,1,3],"\u00e9crit":[5,1],simplif:3,corrig:[5,3],notion:[5,3],"n\u00e9cessair":[5,2],texz:6,ajout:6,arithmetiqu:[0,1,9],fini:2,radic:6,"lisibilit\u00e9":5,fichier:1,priorites3:[0,2,9],ptex:6,quel:0,choisi:5,estnombr:2,factor:1,"__call__":5,analys:2,"\u00e9tablit":1,express:[0,5,2,9],repr:[5,3],cherche_class:2,recherche_somm:2,trouver:2,"import":[1,5,2,6,7,3],ecrit_tex:1,thenocalcul:1,ordonn:5,monom:5,partir:[5,2,3],mettr:6,"d\u00e9veloppeur":0,"caract\u00e8r":[5,2,3],fait:6,fair:[5,3],"cr\u00e9e":[5,3],automatiqu:1,decompos:3,recherche_parenthes:2,nul:[5,2],particip:0,rendr:1,"\u00e9gale":[5,2],pyromath:[0,1,2,6,5,3,7,8,9],facteur:1,comm:5,polynomescolleg:[0,8,5,2],vrai:6,addit:2,"d\u00e9tail":[1,3],positif:[1,6],ell:[5,2],alor:[5,6],tout:[5,2],aura:1,"ins\u00e9rer":1,autour:6,point:5,pow:5,devrait:5,"g\u00e8re":6,quatriem:1,"__rsub__":[5,3],cancel:3,respect:2,outil:[0,1,2,6,7,9],invers:3,tient:5,"__len__":5,"distributivit\u00e9":5,restant:2,"\u00e9critur":[6,2,3],"identit\u00e9":5,laquel:2,rang:5,"__eq__":5,emploi:6,align:1,"__iadd__":5,calcul:[5,2,1,3],"__sub__":[5,3],devra:2,puissanc:[6,5,2,3],recherche_neg:2,fractionnair:3,conten:[5,2],raison:5,"__init__":5,par:[6,5,2,1,3],"pr\u00e9ciser":3,"d\u00e9pendant":5,parti:6,min_i:2,traiter:2,document:0,"__repr__":[5,3],ppcm:1,"__add__":[5,3],"\u00e9valuat":[0,2,9],"bin\u00f4m":5,"modifi\u00e9":5,"encha\u00een":2,calculatoir:[0,2,9],"r\u00e9cup\u00e9rer":2,parenthes:6,lequel:1,"__div__":3,cet:2,command:6,"__neg__":[5,3],left:[2,6],remarqu:5,newton:5,obtenir:[2,1],rapid:2,expos:2,"\u00e9t\u00e9":1,priorit:2,param:[5,3],exempl:2,real:3,combien:1,format:[2,1,6],post_fract:2,racin:2,"d\u00e9finit":[1,3],bpc:6,docutil:[1,5,2,6,7,3],integ:[6,5,2,1,3],bpn:6,recherche_fin_oper:2,page:0,"degr\u00e9":[7,5,6],"corrig\u00e9":1,multipla:2,right:[2,6],somm:[6,5,2,3],"mon\u00f4m":[5,6],born:1,polynom:[5,2],convertit:[7,2],"int\u00e9grer":2,est:[6,5,2,1,3],sachant:0,"\u00e9valuabl":[5,3],avoir:2,foi:[5,2],radian:7,"premi\u00e8r":2,"__ne__":5,plu:[2,1,3],split_calcul:2,cherche_decim:2,"\u00eatre":[5,2,3],permettr:0,pgcd:1,"__mul__":[5,3],"11_":3,"donn\u00e9":7,"num\u00e9rot":1,"v\u00e9rifier":2,"float":[7,5,1],son:3,sou:6,retourn:[5,2,1,3],"72_":3,"n\u00e9gatif":6,span:[1,5,2,6,7,3],avenir:2,fraction:[0,2,6,5,3,8],suit:[5,2],"var":[5,6],"__invert__":3,tupl:[2,1],fractex:6,"\u00e9quation":1,inclu:2,"true":[5,2,6],bug:5,temp:2,maximum:0,recherche_produit:2,"cha\u00een":[5,2,3],"simplifi\u00e9":2,constant:5,chercher:2,petit:1,utilis:[5,2,6],"op\u00e9rateur":2,"v\u00e9rifiant":2,eratosthen:1,cherche_operateur:2,"pr\u00e9c\u00e9dent":5,other:[5,3],test:[2,1],introduit:5,"r\u00e9guli\u00e8r":2,liste_calcul:2,developp:1,reduction_detaille:5,"sup\u00e9rieur":[5,2,1],"ordonn\u00e9":[5,2],"param\u00e8tr":[1,5,2,6,7,3],ttex:6,"d\u00e9velopp":[0,5],ignor:2,time:[1,3],"d\u00e9composit":3},objtypes:{"0":"py:module","1":"py:method","2":"py:function","3":"py:class"},titles:["Bienvenue dans la documentation de Pyromaths !","3.2. <tt class=\"docutils literal\"><span class=\"pre\">Arithmetique</span></tt> &#8212; Fonctions arithm\u00e9tiques","3.4. <tt class=\"docutils literal\"><span class=\"pre\">Priorites3</span></tt> &#8212; \u00c9valuation d&#8217;une expression calculatoire","2.1. <tt class=\"docutils literal\"><span class=\"pre\">Fractions</span></tt> &#8212; Nombres rationnels","1. Introduction","2.2. <tt class=\"docutils literal\"><span class=\"pre\">PolynomesCollege</span></tt> &#8212; Fonctions polyn\u00f4mes","3.1. <tt class=\"docutils literal\"><span class=\"pre\">Affichage</span></tt> &#8212; Fonctions d&#8217;affichage","3.3. <tt class=\"docutils literal\"><span class=\"pre\">Conversions</span></tt> &#8212; Fonctions de conversions","2. Les classes de Pyromaths","3. Les outils de Pyromaths"],objnames:{"0":["py","module","Python module"],"1":["py","method","Python m\u00e9thode"],"2":["py","function","Python fonction"],"3":["py","class","Python classe"]},filenames:["index","pyromaths.outils.Arithmetique","pyromaths.outils.Priorites3","pyromaths.classes.Fractions","intro","pyromaths.classes.PolynomesCollege","pyromaths.outils.Affichage","pyromaths.outils.Conversions","pyromaths.classes","pyromaths.outils"]})
\ No newline at end of file
......@@ -530,6 +530,7 @@ def post_fractions(calcul, final = False):
* les produits au numérateur et dénominateur sont effectuée dans les sommes et différences de fractions
* les produits au numérateur et dénominateur sont simplifiés sinon
* les fractions de dénominateur 1 sont changées en entier
:param calcul: le calcul à traiter
:type calcul: list
......@@ -537,8 +538,8 @@ def post_fractions(calcul, final = False):
:type final: boolean
>>> from pyromaths.classes.PolynomesCollege import Polynome
>>> Priorites3.post_fractions(['Fraction(3*4, 2*4, "r") + Fraction(5, 8)'])
['Fraction(12, 8) + Fraction(5, 8)']
>>> Priorites3.post_fractions(['Fraction(3*4, 2*4, "r")', '+', 'Fraction(5, 8)'])
['Fraction(12, 8)', '+', 'Fraction(5, 8)']
>>> Priorites3.post_fractions(['Fraction(3*4*5, 2*4, "s")'])
['Fraction(15, 2)']
......@@ -556,7 +557,8 @@ def post_fractions(calcul, final = False):
index += 1
return e
if len(e) > 1:
for k in range(len(e)):
k = 0
while k < len(e):
index = 0
while index < len(e[k]) and 'Fraction(' in e[k][index:]:
index = e[k].index('Fraction(', index)
......@@ -566,7 +568,20 @@ def post_fractions(calcul, final = False):
e[k] = e[k][:index] + repr(Fraction.simplifie(frac)) + splitted[2]
elif frac.code == "r":
e[k] = e[k][:index] + repr(Fraction.reduit(frac)) + splitted[2]
elif frac.d == 1:
if frac.n < 0:
if k and e[k-1] == '+':
e[k-1] = '-'
e[k] = str(abs(frac.n))
else:
e.insert(k+1, ')')
e.insert(k+1, str(frac.n))
e[k] = '('
k+=2
else:
e[k] = str(frac.n)
index += 1
k += 1
else:
index = 0
while index < len(e[0]) and 'Fraction(' in e[0][index:]:
......
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