Re: Derivative of a function with multiple variables

• To: mathgroup at smc.vnet.net
• Subject: [mg69483] Re: Derivative of a function with multiple variables
• From: dh <dh at metrohm.ch>
• Date: Thu, 14 Sep 2006 06:54:52 -0400 (EDT)
• References: <ee8grk\$itd\$1@smc.vnet.net>

```Hi Adel,
you nearly got it yourself. Define:
g[f_[x_,y_,z]]:={{Derivative[2,0,0][f][x,y,z], Derivative[1,1,0][f][x,y,z],
Derivative[1,0,1][f][x,y,z]},
{Derivative[1,1,0][f][x,y,z], Derivative[0,2,0][f][x,y,z],
Derivative[0,1,1][f][x,y,z]},
{Derivative[1,0,1][f][x,y,z], Derivative[0,1,1][f][x,y,z],
Derivative[0,0,2][f][x,y,z]}};
SetASttributes[g,HoldFirst];
the last line is necessary to preven evaluation of f.
now you could say:
f[x_,y_,z_]:=x^4+y^5+z^6;
g[f[x,y,z]]
and you get back:
{{12 x^2, 0, 0}, {0, 20 y^3, 0}, {0, 0, 30 z^4}}

Daniel
> Hi all,
>
> I am sure this is easy to many of you
>
> Assume I have f = f[x,y,z]
> I would like to construct a simple function g[f[x,y,z]] that will
> generate the Hessian. i.e.
> g[f[x,y,z]]=
> {{Derivative[2,0,0][f][x,y,z], Derivative[1,1,0][f][x,y,z],
> Derivative[1,0,1][f][x,y,z]},
> {Derivative[1,1,0][f][x,y,z], Derivative[0,2,0][f][x,y,z],
> Derivative[0,1,1][f][x,y,z]},
> {Derivative[1,0,1][f][x,y,z], Derivative[0,1,1][f][x,y,z],
> Derivative[0,0,2][f][x,y,z]}}.
>
> Any help?
>

```

• Prev by Date: Re: Differential equation
• Next by Date: Re: Derivative of a function with multiple variables
• Previous by thread: Re: Derivative of a function with multiple variables
• Next by thread: Re: Derivative of a function with multiple variables