for symbol in substitutions:
if not isinstance(symbol, Symbol):
raise TypeError('symbols must be Symbol instances')
- result = self._constant
+ result = Rational(self._constant)
for symbol, coefficient in self._coefficients.items():
expression = substitutions.get(symbol, symbol)
result += coefficient * expression