# Derivatives of function with 20 variables with respect to each variable

I want to find the derivative of a function with 20 variables and arrange it in a 20 by 1 vector.

Si[a,b,c,d,.....20 variables] is a function. Is there a simple command to find the first derivative of each variable and arrange it in a 20 by 1 vector as follows

{D[Si,a],D[Si,b],....D[si,t]}

Similarly, I want to find the second derivative and arrange it in a 20 by 20 matrix as follows

{{D[D[Si, a], a], D[D[Si, a], b], ... .. D[D[Si, a], t]}, {D[D[Si, b], a],D[D[Si, b], b], ... .. D[D[Si, b], t]}, ... ... ...., {D[D[Si, t], D[D[Si, t], b], ....D[D[Si, t], t]}}


args = Array[x, 20];
D[f @@ args, {args, 1}]
D[f @@ args, {args, 2}]

• +1 More generally, for any non-negative integer m: D[f @@ args, {args, m}] == Nest[D[#, {args}] &, f @@ args, m] – Bob Hanlon Dec 11 '19 at 15:56

first ,let's creat a funtion

si = Si @@ (ToExpression /@ Alphabet[])


then you just need this

Defer@D[si, #] & /@ (ToExpression /@ Alphabet[])