-
-
Notifications
You must be signed in to change notification settings - Fork 697
Closed
Description
The docstring for subs_expr (in calculus.py) says:
Given a dictionary of key:value pairs, substitute all occurences of key for value in self.
...but the function does not accept a dictionary:
def subs_expr(self, *equations):
It'll take an arbitrary number of regular parameters (which must be SymbolicEquations), but not a dictionary.
I tried to modify the function to something like the following, but couldn't get it to work. Someone familiar with this code should have no problem implementing it correctly:
def subs_expr(self, *equations, **equationsdict):
for x in equations:
if not isinstance(x, SymbolicEquation):
raise TypeError, "each expression must be an equation"
R = self.parent()
v = ','.join(['%s=%s'%(x.lhs()._maxima_init_(), x.rhs()._maxima_init_()) \
for x in equations])
v = v + ','.join(['%s=%s' % (key._maxima_init_(), \
equationsdict[key]._maxima_init_()) for key in equationsdict.keys()]
return R(self._maxima_().subst(v))
Component: calculus
Keywords: substitution, subs_expr
Issue created by migration from https://trac.sagemath.org/ticket/2404