Re: Maintaining values of variables
- To: mathgroup@smc.vnet.net
- Subject: [mg11793] Re: Maintaining values of variables
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Sat, 28 Mar 1998 00:25:28 -0500
- References: <6fd5n9$6bi@smc.vnet.net>
blimbaum_jerry@ccmail.ncsc.navy.mil wrote: > > I notice that Mathematica maintains the value of variables from > previous work even if the files for that work are closed. I find > this > positively annoying. Can someone explain the rational for this? > Also, the In/Out numbering..Why is this seqence not unique to the > file > I'm working with, i.e. I would expect In=1 at the start of each > file. > Again, what is the rational? > > Thanks. Jerry Blimbaum US Navy Lab, Panama City, Florida Jerry: VALUES Values are kept until the kernel is closed (by quitting Mathematica or just the kernel) or they are cleared by using a command like Clear see below. In[62]:= ?Clear "Clear[symbol1, symbol2, ... ] clears values and definitions for the symboli. \ Clear[\"form1\", \"form2\", ... ] clears values and definitions for all \ symbols whose names match any of the string patterns formi." More in the Help Browser Examples: In[58]:= a=2; b=3; In[59]:= Clear[a,b] In[60]:= {a,b} Out[60]= {a,b} I find the following very useful: Clear["`*"] clears all values for unprotected symbols in the Global context (the usual interactive one). IN/ OUT NUMBERS In[] Out[] numbering works similarly We can reset the numbering - at the risk of losing references by line number. In[63]:= $Line = 0; In[1]:= a=2 Out[1]= 2 RATIONAL We can work with multiple notebooks. -- Allan Hayes Mathematica Training and Consulting Leicester, UK hay@haystack.demon.co.uk http://www.haystack.demon.co.uk voice: +44 (0)116 271 4198 fax: +44 (0)116 271 8642