"""
if not isinstance(symbol, Symbol):
raise TypeError('symbol must be a Symbol instance')
- return Rational(self._coefficients.get(symbol, 0))
+ return self._coefficients.get(symbol, Fraction(0))
__getitem__ = coefficient
expression. The constant term is ignored.
"""
for symbol, coefficient in self._coefficients.items():
- yield symbol, Rational(coefficient)
+ yield symbol, coefficient
@property
def constant(self):
"""
The constant term of the expression.
"""
- return Rational(self._constant)
+ return self._constant
@property
def symbols(self):
term.
"""
for coefficient in self._coefficients.values():
- yield Rational(coefficient)
- yield Rational(self._constant)
+ yield coefficient
+ yield self._constant
def __bool__(self):
return True