Ask Your Question

Revision history [back]

click to hide/show revision 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?