Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Evaluating symbolic expressions

Hi all,

I have to evaluate in Sage a symbolic expression and, by some constrains of my problem, I have to use a dictionary to do so. Everything goes smooth with symbolic expressions like the following:

var('x,y')
h = x^3+y^3 
type(h) #returns sage.symbolic.expression.Expression 
h({x:0,y:1}) #returns 1

But, when I use a symbolic expression defined with arguments, it fails:

g(x,y) = x^3+y^3 
type(g) #returns also sage.symbolic.expression.Expression 
g({x:0,y:1})

And returns "TypeError: no canonical coercion from <type 'dict'=""> to Callable function ring with arguments (x, y)"

Since both expressions are "sage.symbolic.expression.Expression", why does that occur? Any help would be appreciated.