2.11 Finite Difference Approximations of Derivatives

2.11  Finite Difference Approximations of Derivatives

Suppose the derivative of a function f : →  is needed at a specific point x[0]. If an analytic expression for f ′ is unavailable, the derivative can be approximated based upon a finite difference:6


The scalar h should be small, but not so small that roundoff error distorts the result. Often, the value f{x[0]) is already known. If valuing f at two additional points will be computationally expensive, one valuation can be avoided by using the alternative approximation:


We call [2.131] a central approximation and [2.132] a forward approximation. These generalize to multiple dimensions. A partial derivative of a function f : n →  can be approximated at point x[0] with a central approximation:


where ei is a vector whose only nonzero component is its ith component, which equals 1. The corresponding forward approximation is



Consider f : 2 → 2:


Value the Jacobian matrix of f at x = (1, 1) three different ways:

  1. analytically,
  2. with a central approximation,
  3. with a forward approximation.

In items (b) and (c), use h = .00001.