ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 02 Apr 2016 00:52:40 +0200Getting symbolic variable without resetting python variable.https://ask.sagemath.org/question/32949/getting-symbolic-variable-without-resetting-python-variable/When calling
var('x')
the variable x gets set to the symbolic expression x just as if we had called
x = var('x')
In particular, any value stored in x is deleted. Is there a way to get a symbolic variable without setting the python variable to be that symbolic variable? I'm not super familiar with how sage handles symbolic variables so this might be unreasonable.Fri, 01 Apr 2016 23:11:17 +0200https://ask.sagemath.org/question/32949/getting-symbolic-variable-without-resetting-python-variable/Answer by vdelecroix for <p>When calling</p>
<pre><code> var('x')
</code></pre>
<p>the variable x gets set to the symbolic expression x just as if we had called</p>
<pre><code>x = var('x')
</code></pre>
<p>In particular, any value stored in x is deleted. Is there a way to get a symbolic variable without setting the python variable to be that symbolic variable? I'm not super familiar with how sage handles symbolic variables so this might be unreasonable.</p>
https://ask.sagemath.org/question/32949/getting-symbolic-variable-without-resetting-python-variable/?answer=32952#post-id-32952Yes there is
sage: t = 19
sage: my_variable = SR.var('t')
sage: t
19
sage: my_variable
t
The behavior of **var** is very strange and controversial.Sat, 02 Apr 2016 00:52:40 +0200https://ask.sagemath.org/question/32949/getting-symbolic-variable-without-resetting-python-variable/?answer=32952#post-id-32952