setdelayed function
- To: mathgroup at smc.vnet.net
- Subject: [mg27953] setdelayed function
- From: "Pek" <phsoh at alum.mit.edu>
- Date: Mon, 26 Mar 2001 05:27:02 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
I am trying the setdelayed function but I didn't understand why the
solution differs between the two methods below:
Method 1 with setdelayed
In[4]:=
p := 28^2 + 300^2 - 2*28*300*Cos[40 Degree]
In[2]:=
test1[x_] := Level[Unevaluated[x], 1]
In[5]:=
test1[p]
Out[5]=
{90784, -16800 Cos[40 Degree]}
Method 2 without setdelayed
In[9]:=
Level[Unevaluated[28^2 + 300^2 - 2*28*300*Cos[40 Degree]], 1]
Out[9]=
{784, 90000, -16800 Cos[40 Degree]}
Finally, Out[9] is what is I wanted but I would like to get this
result using setdelayed. Did I use setdelayed incorrectly?
Would really appreciate your help.
Thanks.
Pek