2 __all__
= ['RingInterface']
4 from ..core
import init_module
8 from ..core
import heads
9 for n
,h
in heads
.iterNameValue(): setattr(m
, n
, h
)
18 """ Construct a symbolic expression with addition operands
21 return ADD
.reevaluate(cls
, seq
)
25 return SUB
.reevaluate(cls
, seq
)
29 """ Construct a symbolic expression with multiplication
30 operands list representation.
32 return MUL
.reevaluate(cls
, seq
)
36 return DIV
.reevaluate(cls
, seq
)
39 def Pow(cls
, base
, exp
):
40 return POW
.new(cls
, (base
, exp
))
44 """ Construct a symbolic expression with term-coefficient
47 return TERM_COEFF_DICT
.reevaluate(cls
, dict(seq
))
50 def Factors(cls
, *seq
):
51 """ Construct a symbolic expression with base-exponent
54 return BASE_EXP_DICT
.reevaluate(cls
, dict(seq
))
57 def Polynom(cls
, *seq
, **kws
):
58 """ Construct a symbolic expression with exponent-coefficient
61 Polynom(x,y) -> Algebra(EXP_COEFF_DICT, Pair((x,y), {(1,0):1, (0,1):1}))
62 Polynom(x,y, variables=(x,y,z)) -> Algebra(EXP_COEFF_DICT, Pair((x,y,z), {(1,0,0):1, (0,1,0):1}))
65 return r
.head
.to_EXP_COEFF_DICT(cls
, r
.data
, r
, kws
.get('variables'))