Re: How can you get the list of all used variables and functions
- To: mathgroup at smc.vnet.net
- Subject: [mg91924] Re: How can you get the list of all used variables and functions
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 13 Sep 2008 05:53:31 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <gadcrg$rqi$1@smc.vnet.net>
Weber wrote:
> How can you get the list of all used variables and functions in
> Mathematica? Is that possible?
Depending on what you intend to do with the result, you could use ? or
Names. For instance, the following will give you all the user defined
functions and variables (located in the context Global by default)
In[1]:= f[x_] := x^2
In[2]:= g[x_, y_] := x^2 + y^2
In[3]:= ?Global`*
Global`
f g x y
In[4]:= lst = Names["Global`*"]
Out[4]= {"f", "g", "lst", "x", "y"}
In[5]:= Definition /@ lst // TableForm
Out[5]//TableForm=
2
f[x_] := x
2 2
g[x_, y_] := x + y
lst = {f, g, lst, x, y}
Null
Null
Regards,
-- Jean-Marc