Ask Your Question

Revision history [back]

Symbolic expressions is a big bundle of stuff. For example, you can notice that pi is also symbolic expression:

sage: type(pi)
<type 'sage.symbolic.expression.Expression'>

Some equations are also symbolic expressions:

sage: type(x^2 + 1 == x)
<type 'sage.symbolic.expression.Expression'>

You can notice, that g and h have the same type, but not the same parent:

sage: g.parent()
Callable function ring with arguments (x, y)
sage: h.parent()
Symbolic Ring

Since g is callable, the way to evaluate it is supposed to be:

sage: g(0,1)
1

If you want do deal uniformly with g and h, you can use the .subs() method:

sage: h.subs({x:0,y:1})
1
sage: g.subs({x:0,y:1})
(x, y) |--> 1