Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problems evaluating Grad

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39407] Re: [mg39372] Problems evaluating Grad
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 14 Feb 2003 03:19:07 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On second thoughts, it seems clear that what is happening in your case 
is that you must have tried evaluating Grad before loading in the 
package and because of the effect of "shadowing" of symbols you are 
getting your input back as output. But normally tat would have produced 
a warning message, which I assume you just ignored.

Andrzej

On Thursday, February 13, 2003, at 09:36 PM, Andrzej Kozlowski wrote:

> I think you should read the documentation for the package. Actually, 
> even without that one can guess what must be wrong. You are asking 
> Mathematica to evaluate Grad[a+b]. How is it to know what are the 
> variables and what are the constants?
> If you look at the package documentation you see that you that the 
> answer you get must depend on the coordiante system you are working 
> with. The default coordinate system is:
>
> In[1]:=
> <<Calculus`VectorAnalysis`
>
> In[2]:=
> {CoordinateSystem,Coordinates[]}
>
> Out[2]=
> {Cartesian,{Xx,Yy,Zz}}
>
> So if we use your definition:
>
> In[3]:=
> f[x_,y_]:=x+y
>
> In[4]:=
> Grad[f[Xx,Yy]]
>
> Out[4]=
> {1,1,0}
>
> On the other hand
>
> In[5]:=
> Grad[f[a,b]]
>
> Out[5]=
> {0,0,0}
>
> because a and b are treated as constants. (This of course brings up 
> the question: how did you get Mathematica to return the input at this 
> point? It sounds like you never managed to load the package in in the 
> first place.)
>
> Of course if you suitably change the names of the coordinates you will 
> get the expected answer:
>
> In[6]:=
> Grad[f[a,b],Cartesian[a,b,c]]
>
> Out[6]=
> {1,1,0}
>
> Andrzej Kozlowski
> Yokohama, Japan
> http://www.mimuw.edu.pl/~akoz/
> http://platon.c.u-tokyo.ac.jp/andrzej/
>
>
>
> On Thursday, February 13, 2003, at 06:52 PM, Konrad Den Ende wrote:
>
>> 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
>> ---------------------------------------------------
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/



  • Prev by Date: Re: Simple List question. HELP.
  • Next by Date: Re: Detecting unsuccessful computations
  • Previous by thread: Re: Problems evaluating Grad
  • Next by thread: Simple List question. HELP.