Re: Can Mathematica evaluate step by step
- To: mathgroup at smc.vnet.net
- Subject: [mg29385] Re: [mg29372] Can Mathematica evaluate step by step
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Sat, 16 Jun 2001 02:47:56 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Neri wanted to see how functions or symbols are defined without letting the
definintions evaluate. You have to trick Mathematica to prevent full
evaluation. The solution below might help.
----------
In[1]:=
f1:=2 a
In[2]:=
f2[x_]:=2 x
In[3]:=
a=4; x=4;
In[5]:=
Extract[OwnValues[f1],{1,2},HoldForm]
Out[5]=
2 a
In[6]:=
Extract[DownValues[f2],{1,2},HoldForm]
Out[6]=
2 x
------------------
I also wrote packages with functions related to what you are trying to do.
You can download them from.
http://www.mathsource.com/cgi-bin/msitem?0211-532
and
http://www.mathsource.com/cgi-bin/msitem?0211-587
Dave Park provides a slightly different version of some of these features.
To get that version download the Expression Manipulation package posted at
http://home.earthlink.net/~djmp/Mathematica.html
----------------
Cheers,
Ted Ersek
Download Mathematica tips, tricks from
http://www.verbeia.com/mathematica/tips/Tricks.html