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.Tue, 20 Sep 2016 08:49:21 +0200how to kill a variablehttps://ask.sagemath.org/question/34855/how-to-kill-a-variable/ Earlier I have defined on my Sage that variable `f` equals to some expression. Later on I no longer need `f` to be that expression. I just need it to be a variable. I know in PARI we have the function `kill(f)`. I tried that on Sage but it did not work. Can I kill a variable that I have defined earlier on Sage.Mon, 19 Sep 2016 10:02:01 +0200https://ask.sagemath.org/question/34855/how-to-kill-a-variable/Answer by daniele for <p>Earlier I have defined on my Sage that variable <code>f</code> equals to some expression. Later on I no longer need <code>f</code> to be that expression. I just need it to be a variable. I know in PARI we have the function <code>kill(f)</code>. I tried that on Sage but it did not work. Can I kill a variable that I have defined earlier on Sage.</p>
https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?answer=34856#post-id-34856Use "[reset](http://doc.sagemath.org/html/en/reference/misc/sage/misc/reset.html?highlight=reset#module-sage.misc.reset)" command:
> `reset('f')`
Related question: ["How can I clear an assignment to a variable?"](https://ask.sagemath.org/question/8172/how-can-i-clear-an-assignment-to-a-variable/)Mon, 19 Sep 2016 10:31:20 +0200https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?answer=34856#post-id-34856Comment by paulmasson for <p>Use "<a href="http://doc.sagemath.org/html/en/reference/misc/sage/misc/reset.html?highlight=reset#module-sage.misc.reset">reset</a>" command:</p>
<blockquote>
<p><code>reset('f')</code></p>
</blockquote>
<p>Related question: <a href="https://ask.sagemath.org/question/8172/how-can-i-clear-an-assignment-to-a-variable/">"How can I clear an assignment to a variable?"</a></p>
https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?comment=34862#post-id-34862Need quotes around variable name: `reset('f')`Mon, 19 Sep 2016 22:46:59 +0200https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?comment=34862#post-id-34862Comment by Sha for <p>Use "<a href="http://doc.sagemath.org/html/en/reference/misc/sage/misc/reset.html?highlight=reset#module-sage.misc.reset">reset</a>" command:</p>
<blockquote>
<p><code>reset('f')</code></p>
</blockquote>
<p>Related question: <a href="https://ask.sagemath.org/question/8172/how-can-i-clear-an-assignment-to-a-variable/">"How can I clear an assignment to a variable?"</a></p>
https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?comment=34864#post-id-34864Thank you so much. It worked!Tue, 20 Sep 2016 01:45:46 +0200https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?comment=34864#post-id-34864Comment by daniele for <p>Use "<a href="http://doc.sagemath.org/html/en/reference/misc/sage/misc/reset.html?highlight=reset#module-sage.misc.reset">reset</a>" command:</p>
<blockquote>
<p><code>reset('f')</code></p>
</blockquote>
<p>Related question: <a href="https://ask.sagemath.org/question/8172/how-can-i-clear-an-assignment-to-a-variable/">"How can I clear an assignment to a variable?"</a></p>
https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?comment=34866#post-id-34866@paulmasson: thanks, corrected!Tue, 20 Sep 2016 08:49:21 +0200https://ask.sagemath.org/question/34855/how-to-kill-a-variable/?comment=34866#post-id-34866