Re: Derivative of a function with multiple variables
- To: mathgroup at smc.vnet.net
- Subject: [mg69502] Re: Derivative of a function with multiple variables
- From: dimmechan at yahoo.com
- Date: Thu, 14 Sep 2006 06:56:10 -0400 (EDT)
- References: <ee8grk$itd$1@smc.vnet.net>
***See The Mathematica Book Section 3.5.1 ***You can get what you want executing the command D[f[x,y,z],{{x,y,z},2}]. Indeed D[f[x,y,z],{{x,y,z},2}] {{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]}} **One can also get previous result using properly the built-in function Outer Information[Outer] Outer[f, list1, list2, ... ] gives the generalized outer product of the listi, forming all possible combinations of the lowest-level elements in each of them, and feeding them as arguments to f. Outer[f, list1, list2, ... , n] treats as separate elements only sublists at level n in the listi. Outer[f, list1, list2, ... , n1, n2, ... ] treats as separate elements only sublists at level ni in the corresponding listi. InputForm[Attributes[Outer] = {Protected}] Outer[D,{f[x,y,z]},{x,y,z},{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]}}} ***Cheers Dimitris Î?/Î? Adel Elsabbagh ÎγÏ?αÏ?ε: > 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? > > -- > Adel Elsabbagh