MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Keeping track of variables used in Mathematica

  • To: mathgroup at
  • Subject: [mg122944] Re: Keeping track of variables used in Mathematica
  • From: David Bailey <dave at>
  • Date: Thu, 17 Nov 2011 07:02:47 -0500 (EST)
  • Delivered-to:
  • References: <ja00p0$61k$>

On 16/11/2011 09:46, Dana DeLouis wrote:

> There was a suggestion for $NewSymbol, but I had mixed results.

I made that suggestion

> Did you or anyone else get this idea to work.  Here's what I mean.
> At the top of a third workbook, the best I came up with is the following:
> NewNames={};
> $NewSymbol=AppendTo[NewNames,#1]&;

You could try:

If[! ValueQ[NewNames],NewNames={}]

This will only set it once, even if you re-evaluate the notebook. (BTW, 
you really should avoid fully capitalised names like NewNames - such 
names are reserved for future Wolfram functions).

I would also restrict the collection to global symbols:


> d=3;
> e=Range[4];
> (* Global has everything *)
> Names["Global`*"]
> {a,b,c,d,e,NewNames}
> (* But NewNames just had d&  e, which seems like what we want *)

I am wondering if the other symbols were spuriously added by some 
packages that get loaded in your environment. I usually pre-load some 
packages, but on a bare mathematica, the Global context appears to be empty.

Extracting the names from the BoxForm in a notebook doesn't seem very 
useful to me - because it doesn't pick up the context of symbols with an 
implicit context.

David Bailey

  • Prev by Date: Re: Error in FullSimplify
  • Next by Date: x and y plot finding maximum
  • Previous by thread: Re: Keeping track of variables used in Mathematica
  • Next by thread: Converting a list of strings to a single space-delimited string