isPolynom move to generic
This commit is contained in:
parent
b5db3df0ec
commit
895c8ed145
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
from .expression import Expression
|
from .expression import Expression
|
||||||
from .operator import op
|
from .operator import op
|
||||||
from .generic import spe_zip, expand_list, isNumber, transpose_fill, flatten_list
|
from .generic import spe_zip, expand_list, isNumber, transpose_fill, flatten_list, isPolynom
|
||||||
#from .generic import spe_zip, sum_postfix, expand_list, isNumber
|
|
||||||
from .render import txt
|
from .render import txt
|
||||||
from .random_expression import RdExpression
|
from .random_expression import RdExpression
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
@ -228,19 +227,12 @@ class Polynom(object):
|
|||||||
|
|
||||||
def conv2poly(self, other):
|
def conv2poly(self, other):
|
||||||
"""Convert anything number into a polynom"""
|
"""Convert anything number into a polynom"""
|
||||||
if isNumber(other) and not self.isPolynom(other):
|
if isNumber(other) and not isPolynom(other):
|
||||||
return Polynom([other])
|
return Polynom([other])
|
||||||
elif self.isPolynom(other):
|
elif isPolynom(other):
|
||||||
return other
|
return other
|
||||||
else:
|
else:
|
||||||
raise ValueError(type(other) + " can't be converted into a polynom")
|
raise ValueError(type(other) + " can't be converted into a polynom")
|
||||||
|
|
||||||
def isPolynom(self, other):
|
|
||||||
try:
|
|
||||||
other._isPolynom
|
|
||||||
except AttributeError:
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def reduce(self):
|
def reduce(self):
|
||||||
"""Compute coefficients which have same degree
|
"""Compute coefficients which have same degree
|
||||||
|
Loading…
Reference in New Issue
Block a user