| 1 | initial version |
The syntax ex.substitute(a=b, c=d) is read by binding the a and c identifiers to b and d respectively in a list of keyword arguments passed to the body of the subs method. This is possible if and only if a and c are acceptable python identifiers. Something like q12^2 is not.
Using either ex.subs([a==b, c==d]) or ex.subs({a:b, c:d}) syntaxes do not have this limitation ; BTW, the latter is the only one accepted by sympy ; standardizing on it might be a good idea.
HTH,
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.