Computing Derivatives - Derive.nb

The Easy Way

There are two ways in which to compute the derivative. Let's start with the easier way: Define the function, let's say f(x), then evaluate f '(x).

When you define a function, it is essential to include the "_"-character on the left side of the definition; this is the signal for Mathematica to treat the "x" as a variable.

f[x_] = x^2

f'[x]

f'[5]

f'[2  y]

You can also compute higher derivatives this way:

g[x_] = Sin[x]

g''[x]

g'''[x]

The Alternative Way

This method uses the command "D" to compute derivatives.

D[x^10, x]

You can indicate also that you want to find higher derivatives. Here is the third derivative of (x^10):

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

This works nicely for partial derivatives you encounter in Calculus III or Differential Equations. The next command evaluates the partial derivative of the function with respect to y:

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

Here is a mixed derivative (∂^2) f/∂x ∂y.

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

How do you evaluate the derivative at a point? (In the next command. read "/.{x->2}" as "afterwards replace x by 2")

D[x^2, x] /. {x -> 2}

D[x^2  y^3, x, y] /. {x -> 1, y -> 2}

A More Complicated Example

Let's create a list of the first 10 derivatives of the following function:

f[x_] = Exp[-x^2]

Here is the - for instance - the second derivative:

D[f[x], {x, 2}]

Here is the whole list, using the "Table" command. ("n" is a dummy variable, "{n,1,10,1}" means that n will take all values from 1 to 10, incrementing by 1.)

Table[D[f[x], {x, n}], {n, 1, 10, 1}] // TableForm

What about the derivatives evaluated at 0? Here we go:

Table[D[f[x], {x, n}] /. {x -> 0}, {n, 1, 10, 1}] // TableForm

Etc.

Author: H. Knaust (helmut@math.utep.edu)
Created: August 2000
Last Edits: August 18, 2000