Mathematica 9 is now available
Previous section-----Next section

3.5.1 Differentiation

D[f, x] partial derivative
D[f, x, y, ... ] multiple derivative
D[f, {x, n}] n derivative
D[f, x, NonConstants -> { ,  , ... }]
 with the  taken to depend on

Partial differentiation operations.
This gives  .

In[1]:=  D[x^n, x]

Out[1]=

This gives the third derivative.

In[2]:=  D[x^n, {x, 3}]

Out[2]=

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

In[3]:=  D[ x[1]^2 + x[2]^2, x[1] ]

Out[3]=

D does partial differentiation. It assumes here that y is independent of x.

In[4]:=  D[x^2 + y^2, x]

Out[4]=

If y does in fact depend on x, you can use the explicit functional form y[x]. Section 3.5.4 describes how objects like y'[x] work.

In[5]:=  D[x^2 + y[x]^2, x]

Out[5]=

Instead of giving an explicit function y[x], you can tell D that y implicitly depends on x. D[y, x, NonConstants->{y}] then represents  , with y implicitly depending on x.

In[6]:=  D[x^2 + y^2, x, NonConstants -> {y}]

Out[6]=

D[f, {{ ,  , ... }}] the gradient of a scalar function f
D[f, {{ ,  , ... }, 2}] the Hessian matrix for f
D[f, {{ ,  , ... }, n}] the   order Taylor series coefficient
D[{ ,  , ... }, {{ ,  , ... }}] the Jacobian for a vector function f

Vector derivatives.
This gives the gradient of the function  .

In[7]:=  D[x^2 + y^2, {{x, y}}]

Out[7]=

This gives the Hessian.

In[8]:=  D[x^2 + y^2, {{x, y}, 2}]

Out[8]=

This gives the Jacobian for a vector function.

In[9]:=  D[{x^2 + y^2, x y}, {{x, y}}]

Out[9]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.