solve bug with random and degree
This commit is contained in:
parent
9e212e5add
commit
9370e8c48b
@ -56,7 +56,7 @@ class Polynom(Explicable):
|
|||||||
if (degree > 0 and degree < 26):
|
if (degree > 0 and degree < 26):
|
||||||
# Générer assez de lettre pour les coefs
|
# Générer assez de lettre pour les coefs
|
||||||
coefs_name = map(chr, range(97, 98+degree))
|
coefs_name = map(chr, range(97, 98+degree))
|
||||||
coefs_form = ["{" + i + "}" for i in coefs_name].reverse()
|
coefs_form = ["{" + i + "}" for i in coefs_name][::-1]
|
||||||
|
|
||||||
form = str(coefs_form)
|
form = str(coefs_form)
|
||||||
# On créé les valeurs toutes concaténées dans un string
|
# On créé les valeurs toutes concaténées dans un string
|
||||||
@ -629,14 +629,14 @@ def test(p,q):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#from .fraction import Fraction
|
#from .fraction import Fraction
|
||||||
with Expression.tmp_render(txt):
|
# with Expression.tmp_render(txt):
|
||||||
p = Polynom([1,2,3])
|
# p = Polynom([1,2,3])
|
||||||
q = Polynom([0, 2])
|
# q = Polynom([0, 2])
|
||||||
for i in (p*q).explain():
|
# for i in (p*q).explain():
|
||||||
print(i)
|
# print(i)
|
||||||
r = Polynom([0,1])
|
# r = Polynom([0,1])
|
||||||
for i in (r*3).explain():
|
# for i in (r*3).explain():
|
||||||
print(i)
|
# print(i)
|
||||||
# print("q = ", q)
|
# print("q = ", q)
|
||||||
# r = q.reduce()
|
# r = q.reduce()
|
||||||
# print("r = ", r)
|
# print("r = ", r)
|
||||||
@ -645,10 +645,11 @@ if __name__ == '__main__':
|
|||||||
# print(p-q)
|
# print(p-q)
|
||||||
# for i in p-q:
|
# for i in p-q:
|
||||||
# print(i)
|
# print(i)
|
||||||
|
Polynom.random(degree = 2, conditions=["{b**2-4*a*c}>0"]) # Polynom deg 2 with positive Delta (ax^2 + bx + c)
|
||||||
|
|
||||||
|
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod(optionflags=doctest.ELLIPSIS)
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user