Re: [Q] Up values
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg691] Re: [Q] Up values
- From: rknapp (Robert Knapp)
- Date: 10 Apr 1995 13:49:54 GMT
In article <3m4q7g$e47 at news0.cybernetics.net> kessler at halley.sph.unc.edu (Marc Kessler) writes: > > Why isn't the following code giving > > (1,0) 2 > Out[6]= 4 lami [x, y] > > as a result? > > $ math > Mathematica 2.2 for VAX/VMS > Copyright 1988-93 Wolfram Research, Inc. > -- Motif graphics initialized -- > > In[1]:= li = lami[x,y]; > > In[2]:= lami/: D[lami[x,y],{x,2}] = 0; > > In[3]:= lami/: D[lami[x,y],{y,2}] = 0; > > In[4]:= lami/: D[lami[x,y],x,y] = 0; > > In[5]:= vert = 2li^2 - li; > > In[6]:= D[vert,{x,2}] > > (1,0) 2 (2,0) (2,0) > Out[6]= 4 lami [x, y] - lami [x, y] + 4 lami[x, y] lami [x, y] > > I have the same problem when I use > lami/: D[lami[x_,y_],{x_,2}] = 0; ... > > Thanks for the help. The reason this doesn't work is that the function D usually ends up using the operator Derivative. Thus, for example, the definition of D[a[x],x] (either with upcode or downcode) does not necessarily affect the value of, say, D[(a[x])^2,x], because the latter is computed in the end using Derivative. In[1]:= a /: D[a[x],x] = 0 Out[1]= 0 In[2]:= D[a[x],x] Out[2]= 0 In[3]:=D[(a[x])^2,x] Out[3]=2 a[x] a'[x] The solution is to make your definitions with respect to Derivative: In[4]:=li = lami[x,y]; In[5]:=lami/: Derivative[2,0][lami] = 0&; In[6]:=lami/: Derivative[0,2][lami] = 0&; In[7]:=lami/: Derivative[1,1][lami] = 0&; In[8]:=vert = 2li^2 - li; In[9]:=D[vert,{x,2}] (1,0) 2 Out[9]= 4 lami [x, y] Rob Knapp WRI