Re: Problems evaluating Grad
- To: mathgroup at smc.vnet.net
- Subject: [mg39425] Re: Problems evaluating Grad
- From: adam.smith at hillsdale.edu (Adam Smith)
- Date: Fri, 14 Feb 2003 03:24:25 -0500 (EST)
- References: <b2fpvg$k66$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
The main difficulty here is that the package Calculus`VectorAnalysis` assumes a default coordinate system Cartesian[Xx,Yy,Zz]. The current Coordinate system used can be viewed by executing Coordinates[]. The functions Grad, Div, Curl are very picky about the coordinates as shown below In[1]:= <<Calculus`VectorAnalysis` In[2]:= Coordinates[] Out[2]= {Xx,Yy,Zz} Below I get what I expect In[3]:= Grad[Xx+Yy] Out[3]= {1,1,0} But using x and y instead of Xx and Yy gives me zero, since the partial derivatives with respect to "Xx" and "Yy" of x+y are zero In[4]:= Grad[x+y] Out[4]= {0,0,0} The solution to this is to set the default coordinates coordinates. In[6]:= SetCoordinates[Cartesian[x,y,z]] Out[6]= Cartesian[x,y,z] Now for x+y things work as expected In[8]:= Grad[x+y] Out[8]= {1,1,0} But your f[a,b] will still give zero because the partial derivatives of a+b with respect to x and y are zero. In[9]:= f[x_,y_]:=x+y In[10]:= f[a,b] Out[10]= a+b In[11]:= Grad[f[a,b]] Out[11]= {0,0,0} I am guessing that you really wanted Grad[f[x,y]] In[12]:= Grad[f[x,y]] Out[12]= {1,1,0} Adam Smith "Konrad Den Ende" <chamsterkonrad at bigfoot.com> wrote in message news:<b2fpvg$k66$1 at smc.vnet.net>... > I'd like to detrmine Grad to a function so i go: > <<Calculus`VectorAnalysis` > f[x_,y_]:=x+y > > Grad[f[a,b]] > > I get no errors, but the answer is simply the same thing > that i asked, as if no computation was done. What do i > do wrong? > > Also - when i evaluated the examples in Help i got the same > behavior. The answer that already is there gets exchanged > to something else upon my evaluation. Namely, the question > itself. What is that?! > > -- > > Vänligen > Konrad > --------------------------------------------------- > phone #1: (+46/0) 708 - 70 73 92 > phone #2: (+46/0) 704 - 79 96 95 > url: http://konrads.webbsida.com > e-mail: chamsterkonrad at bigfoot.com > ----------------------------------- > > Sleep - thing used by ineffective people > as a substitute for coffee > > Ambition - a poor excuse for not having > enough sence to be lazy > ---------------------------------------------------