Re: Dimensions and Variables II
- To: mathgroup at smc.vnet.net
- Subject: [mg13720] Re: [mg13688] Dimensions and Variables II
- From: Wouter Meeussen <eu000949 at pophost.eunet.be>
- Date: Wed, 19 Aug 1998 01:38:13 -0400
- Sender: owner-wri-mathgroup at wolfram.com
hi, you will have to choose if you want to have intermediate forms in 'operator' notation (like Out[8] and Out[9]) or not. It would also be a good time to study the difference between immediate assignment (" = ") and delayed assignment (" := "). Look also at the logical flaw in your reasoning when you write > >a[x_,y_,z_]:=f+g+h > arguments to functions are in fact 'dummy variables' that stand for any given input. Only in the context "f takes the first argument, g the second and h the last" would this eventually make sense. You force this behaviour by saying 'In[6]'. In[1]:= f[x_] := u x g[y_] := v y h[z_] := w z In[4]:= a = f + g + h b = f g h Out[4]=f+g+h Out[5]=f g h In[6]:= a3[x_, y_, z_] = f[x] + g[y] + h[z] b3[x_, y_, z_] = f[x] g[y] h[z] Out[6]=u x+v y+w z Out[7]=u v w x y z In[8]:=a[t1] Out[8]=(f+g+h)[t1] In[9]:=b[t1] Out[9]=(f g h)[t1] In[10]:=Through[a[t1]] Out[10]=t1 u+t1 v+t1 w In[11]:=Through[b[t2]] Out[11]=(t2^3 u v w) In[12]:=L[x_, y_, z_] := a[x, y, z] + b[x, y, z] In[13]:=L[g1, g2, g3] Out[13]=(f g h)[g1,g2,g3]+(f+g+h)[g1,g2,g3] In[14]:=Through /@ % Out[14]=f[g1,g2,g3]+g[g1,g2,g3]+h[g1,g2,g3]+f[g1,g2,g3] g[g1,g2,g3] h[g1,g2,g3] In[15]:=L3[x_, y_, z_] := a3[x, y, z] + b3[x, y, z] In[16]:=L3[g1, g2, g3] Out[16]=g1 u+g2 v+g3 w+g1 g2 g3 u v w I hope I didn't mud the waters to much. wouter. At 04:39 15-08-98 -0400, naum at condor.physics.ucsb.edu wrote: > I am starting to work on the variable problem. I am woried that I >wasn't clear enoughf in my news posting. Here is simple version of the >sort of thing that I am doing. > >f[x_]:=2x >g[y_]:=3y >h[z_]:=4z > >a[x_,y_,z_]:=f+g+h >b[x_,y_,z_]:=f*g*h > >L[x_,y_,z_]:=a+b > >Is there an easier way to do al this, like could I make V:={x,y,z} a >list and then just say L[V_]? does every leval need the explit >dependence declaration? I have tried alot of things and none of then >seem to work. > Thank You for any help you can give > -NAUM > > Dr. Wouter L. J. MEEUSSEN w.meeussen.vdmcc at vandemoortele.be eu000949 at pophost.eunet.be