• To: mathgroup at smc.vnet.net
• Subject: [mg103853] Re: Grad in VectorAnalysis`
• From: Erik Max Francis <max at alcyone.com>
• Date: Fri, 9 Oct 2009 07:17:08 -0400 (EDT)
• References: <hakjlm\$d72\$1@smc.vnet.net>

```Murray Eisenberg wrote:
> After...
>
>    Needs["VectorAnalysis`"]
>    SetCoordinates[Cartesian[x, y, z]]
>
>    f[x_, y_] = x/(1 - x^2 - y^2)
>
> ... why does the following not actually return the formula for gradient...
>
>
> ... whereas the following does return it:
>
>    Grad[x/(1 - x^2 - y^2)]

Because you defined a function with two arguments (f[x, y]).  A function
f with three arguments (f[x, y, z]) is not defined and so Mathematica
leaves it in symbolic form.  Try instead:

Out[6]= {(2 x^2)/(1 - x^2 - y^2)^2 + 1/(1 - x^2 - y^2), (
2 x y)/(1 - x^2 - y^2)^2, 0}

or defining f as taking those three arguments (and just don't use the
third):

In[7]:= f[x_, y_, z_] := x/(1 - x^2 - y^2)

Out[8]= {(2 x^2)/(1 - x^2 - y^2)^2 + 1/(1 - x^2 - y^2), (
2 x y)/(1 - x^2 - y^2)^2, 0}

In[9]:= %6 == %8

Out[9]= True

--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
All generalizations are dangerous, even this one.
-- Dumas Fils

```

• Prev by Date: Re: Google Trends Data and Mathematica
• Next by Date: Re: AxesLabel from expression