Ask Your Question

Revision history [back]

Although underscores can be used to define new variables

sage: var('x,y,z_a')
(x, y, z_a)
sage: z_a

"carrots" cannot be used

sage: var('x,y,z^a')
(x, y, z^a)
sage: z^a
Traceback (click to the left of this block for traceback)
NameError: name 'z' is not defined

This is because in that last statement, z^a, Sage is looking for a variable called z and trying to exponentiate it with some other variable called a. Note that the symbol ^ is used in Sage for exponentiation. In short, you shouldn't use it to define a new variable.