Numerical Analysis

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

(03.24.97) \underline{Applications of Polynomial Interpolation: NUMERICAL DIFFERENTIATION} We shall be using our knowledge of Lagrange Interpolation to come up with formulas that allow us to approximate the derivative of a function as a point, even though we are only given a number of values of the function. From Calculus we know that if we know the function at f(x_{0}) and f(x_{0} + h) then an approximation to the derivative of f(x) at x_{0}, f′(x_{0}) can be written as:

\underline{Example} Consider the function f(x) = ln(x) at x = 1.8. In small groups of 2 or 3, obtain an approximation of the derivative, f′(x), at x = 1.8 using different values of h less than 0.1. Also compute the actual error your approximation makes.

Do you see any relation between the choice of h and the size of the error? What can we do if we want to get a bound on how large the actual error could get?

Write down the Lagrange interpolating polynomial for a function f(x) given that you know the function at (x_{0}, f(x_{0})) and (x_{1}, f(x_{1})) (where x_{1} = x_{0} + h)

Write down the error term e(x):

Let’s write down an exact expression for f(x) in terms of e(x) and P (x) and differentiate it: Now, evaluate this expression for f′(x) at x = x_{0} and use the fact that x_{1} = x_{0} + h to simplify this expression. Look familiar? Suppose that the maximum value that f′ has on [x_{0}, x_{0} + h] is M, then we can write down an error bound for our approximation to f′(x_{0}) \underline{Example} Compute theoretical error bounds for the approximations to f′(1.8) that you had previously made. Compare the actual error to theoretical error bound. What do you see? This particular kind of approximation for f′(x_{0}) is called a Forward Difference Formula. If you replace h with −h then you get the Backward Difference Formula

f′(x_{0}) = \frac{f(x_{0}) − f(x_{0} − h)}{h}

3-point Difference Formulae What if instead of using 2 function values x_{0} and x_{1} = x_{0} + h, we used 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′. Again 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)

If x_{1} = x_{0} + h and x_{2} = x_{0} + 2h this expression simplifies to:

If x_{1} = x_{0} + h and x_{2} = x_{0} − h write down the expression below:

This expression is called a Centered Difference Formula

Draw a sketch indicating how the various difference formulas approximate the derivative at a point. Do you see why they are approximations? What condition do we need on h to improve accuracy?

(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 add 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.