Re: Can Mathematica evaluate step by step???

• To: mathgroup at smc.vnet.net
• Subject: [mg29381] Re: [mg29372] Can Mathematica evaluate step by step???
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Sat, 16 Jun 2001 02:47:52 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```In general not. Mathematica does not do any "half-way" evaluation. However,
you can sort of "get" 2a as follows:

In[1]:=
myfunction:=2a
In[2]:=
a=2;
In[3]:=
myfunction
Out[3]=
4
In[4]:=
Information["myfunction", LongForm -> False]
myfunction
myfunction := 2*a

alternatively:

In[5]:=
OwnValues[myfunction]
Out[5]=
{HoldPattern[myfunction] :> 2*a}

You can extract 2a from the latter but only if you first wrap HoldForm
around it:

In[6]:=
MapAt[HoldForm,OwnValues[myfunction],{1,2}][[1,2]]
Out[6]=
2 a

--
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/~andrzej/

on 01.6.15 3:23 PM, Neri Kafkafi at NKafkafi at intra.nida.nih.gov wrote:

> Assume I define:
> myfunction:=2a
>
> and at some later time:
> a=4
>
> Now if I evaluate myfunction I get 8.
> If I evaluate Hold[myfunction] I get myfunction.
>
> My question is, how do I get 2a ?
>
> In other words, I want to get the symbolic definition of myfunction, whether
> a is defined or not.
>
> In (yet) other words, I want to evaluate myfunction only one step further,
> up to 2a, but not all the way to 8.
>
> Is this possible in Mathematica?
>
> Neri
>
>
>
>
>
>

```

• Prev by Date: Re: A New User
• Next by Date: Re: Java, Graphics Output, MathCanvas
• Previous by thread: Can Mathematica evaluate step by step???
• Next by thread: RE: Can Mathematica evaluate step by step???