| 1 | initial version |
You are confusing two very different notions of "variable".
When you write:
sage: x = 5
The Python name points to the integer 5.
When you write:
sage: reset()
or just
sage: del(x)
you remove the name x from the namespace.
In the symbolic expression cos(x), the x is not a Python name but a mathematical symbol, it is an object, like the integer 5 above.
The confusion might come from the fact that, at Sage startup, the Python name x points to the symbol x:
sage: x
x
sage: x.parent()
Symbolic Ring
sage: x.is_symbol()
True
But once you write x=5, the Python name x now points to the integer 5, and there is no way to let it remember that it used to point to the symbol x. If you want the Python x to point to the symbol x, you can do:
sage: x = SR.var("x")
See for example this question or that question.
| 2 | No.2 Revision |
You are confusing two very different notions of "variable".
When you write:
sage: x = 5
The Python name points to the integer 5.
When you write:
sage: reset()
or just
sage: del(x)
you remove the name x from the namespace.
In the symbolic expression cos(x), the x is not a Python name but a mathematical symbol, it is an object, like the integer 5 above.
The confusion might come from the fact that, at Sage startup, the Python name x points to the symbol x:
sage: x
x
sage: x.parent()
Symbolic Ring
sage: x.is_symbol()
True
But once you write x=5, the Python name x now points to the integer 5, and there is no way to let it remember that it used to point to the symbol x. If you want the Python x to point to the symbol x, you can do:
sage: x = SR.var("x")
See for example This is a very common confusion, see the tag variable_issue, this question or that question.
| 3 | No.3 Revision |
You are confusing two very different notions of "variable".
When you write:
sage: x = 5
The Python name points to the integer 5.
When you write:
sage: reset()
or just
sage: del(x)
you remove the name x from the global namespace.
In the symbolic expression cos(x), the x is not a Python name but a mathematical symbol, it is an object, like the integer 5 above.
The confusion might come from the fact that, at Sage startup, the Python name x points to the symbol x:
sage: x
x
sage: x.parent()
Symbolic Ring
sage: x.is_symbol()
True
But once you write x=5, the Python name x now points to the integer 5, and there is no way to let it remember that it used to point to the symbol x. If you want the Python x to point to the symbol x, again, you can do:
sage: x = SR.var("x")
This is a very common confusion, see the tag variable_issue, this question or that question.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.