Numerical Analysis

Math 370  MWF 2:30-3:25
Spring 1997  201 Fowler

(03.26.97) \underline{Numerical Differentiation Continued} 3-point Difference Formulae Instead of using 2 function values x_{0} and x_{1} = x_{0} + h, it is quite common to use THREE. That is, the function is evaluated at x_{0}, x_{1} and x_{2} and we use these to come up with an approximation to f′. We will use Lagrange polynomial interpolation for f(x) along with the error term in order to try and approximate the derivative function f′(x)

Write down L′_{0}(x), L′_{1}(x) and L′_{2}(x) below:

Write down e′(x) evaluated at a node (say, x_{0})

If x_{1} = x_{0} + h and x_{2} = x_{0} + 2h the formula for f′(x_{0}) simplifies to:

If x_{1} = x_{0} + h and x_{2} = x_{0} − h formula for f′(x_{0}) simplifies to:

This second expression is called a Centered Difference Formula (n+1)-point Difference Formulae In general, if one has n + 1 data points for f(x) at x_{0}, x_{1}, … x_{n} using Lagrange interpolation we can express the function as:

f(x) = ∑_{k=0}^{n} f(x_{k})L_{n,k}(x) + \frac{f^{(n+1)}(ξ(x))}{(n + 1)!}(x − x_{0})(x − x_{1}) ⋯ (x − x_{n})

Differentiating produces...

f′(x) = ∑_{k=0}^{n} f(x_{k})Ln,k^{′}(x) + \frac{d}{dx} [\frac{(x − x_{0})(x − x_{1}) … (x − x_{n})}{(n + 1)!}] f^{(n+1)}(ξ(x))

+\frac{(x − x_{0})(x − x_{1}) … (x − x_{n})}{(n + 1)!} \frac{d}{dx}[f^{(n+1)}(ξ(x))]

But if this evaluated at x_{k} then write down an expression for f′(x_{k}) below:

Taylor Expansions Another way to compute difference formula which approximate derivatives at a point is to use Taylor Approximations. This is useful because again one gets a sense of how good the approximation is as one is making it. For example, let’s write down the third-order Taylor expansion about x_{0} (with error term) for the following expressions: f(x_{0} + h) =

f(x_{0} − h) =

Then subtract these two terms and solve for f′(x_{0})

This should result in the identical form of the 2nd Order centered difference formula for f′(x) obtained by using a 3-point formula.

Higher Order Derivatives Another reason why using the Taylor Expansion method is useful is that one can use it to compute difference formulae for higher-order derivatives. All one needs to do is cancel out as many common terms of the expansion as possible.

For example, let’s write down the fouth-order Taylor expansion about x_{0} (with error term) for the following expressions: f(x_{0} + h) =

f(x_{0} − h) =

Let’s combine these in such a way that we can get a formula for f′′(x_{0})

Round-Off Error Let’s consider the first-order forward difference formula for f′(x_{0}) again. (Write it down below:)

\underline{Example} Consider f(x) = exp(x). I want each member of the class to come up with an approximation to f′(1) using the forward difference formula with h = 10^{−k} where k is an integer. We will do this in alphabetic order. The first person forms the approximation with h = 0.1 and so on. What do you think will happen?

h f(1 + h)  f′(1)  Error

Does it appear as if there an optimal value of h to use?

Explanation Consider that whenever you make a function evaluation there is really some round-off error associated with it, so that f(x) = f̃(x) + e(x). The f̃ is the machine number approximation to the exact f that you are trying to compute and e is the round-off error that the compute produces.

If we look at the forward difference formula we can obtain an expression for the error involved in approximating the derivative due to round-off error, E(h)

Let’s assume that M is a bound for f′′ and that ϵ is a bound on the round-off error. Then we can get an expression for E(h) and we can find out what value of h minimizes it.