Ask Your Question

Revision history [back]

This happens because of the way python handles variables, assignment, and references. Try the following:

sage: var("x,a")
(x, a)
sage: x = cos(a)
sage: a = 1/4
sage: print x
sage: print(a)

In this code, a at first refers to a symbolic variable, then the name a is reassigned to the number 1/4. When x gets printed you still see the symbolic variable there whose name is a.

To get a value for a substituted into x, y, z try using the .subs method:

sage: var('a')
sage: x = cos(a)
sage: x.subs(a=1/4)