Function to differentiate and evaluate any function of several variables

*To*: mathgroup at smc.vnet.net*Subject*: [mg112600] Function to differentiate and evaluate any function of several variables*From*: Faysal Aberkane <faysal.aberkane at gmail.com>*Date*: Wed, 22 Sep 2010 01:57:50 -0400 (EDT)

Hi, I've just written a handy function to differentiate and evaluate at the same time any function of several variables. Here it is. DD::usage = "DD[f_[params__],diffVars__] where params are the parameters where we evaluate the differentiated function f and diffVars is a sequence {variableNumber,differentialOrder} to differentiate f."; SetAttributes[DD, HoldFirst]; DD[f_[params__]] := f[params]; DD[f_[params__], diffVars__] := Module[{diffList}, diffList = ConstantArray[0, Length@{params}]; MapThread[(diffList[[#1]] = #2) &, Transpose[{diffVars}]]; Derivative[##][f][params] & @@ diffList ]; Example: f[x_, y_] := x^4 y^2; DD[f[1, 2], {2, 1}, {1, 3}] (*returns 96*) Should make it easier to rapidly work with derivatives in Mathematica. Cheers