| 1 | initial version |
I think you are looking for the subs() method of symbolic expressions.
sage: var('A B')
(A, B)
sage: data = {A:1,B:2}
sage: expr = A+B
sage: expr
A + B
sage: expr.subs(data)
3
This will substitute as a dictionary. You can also do
sage: expr.subs(A=1,B=2)
3
if you like that syntax. Does that help?
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.