Differentiation

Partial differentiation operations.

This gives (∂/(∂x))(x^n):

D[x^n,x]

This gives the third derivative:

D[x^n,{x,3}]

You can differentiate with respect to any expression that does not involve explicit mathematical operations:

D[x[1]^2+x[2]^2,x[1]]

(RefLink[D, paclet:ref/D]) does partial differentiation. It assumes here that y is independent of x:

D[x^2+y^2,x]

If y does in fact depend on x, you can use the explicit functional form y[x]. "The Representation of Derivatives" describes how objects like y'[x] work:

D[x^2+y[x]^2,x]

Instead of giving an explicit function y[x], you can tell (RefLink[D, paclet:ref/D]) that y implicitly depends on x. (RefLink[D, paclet:ref/D])[y,x,(RefLink[NonConstants, paclet:ref/NonConstants])->{y}] then represents ((∂y)/(∂x)), with y implicitly depending on x:

D[x^2+y^2,x,NonConstants->{y}]

Vector derivatives.

This gives the gradient of the function (x^2)+(y^2):

D[x^2+y^2,{{x,y}}]

This gives the Hessian:

D[x^2+y^2,{{x,y},2}]

This gives the Jacobian for a vector function:

D[{x^2+y^2,x y},{{x,y}}]