Numerical Analysis

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

(03.28.97) \underline{Numerical Differentiation Concludes} Taylor Expansions In the previous class we showed that we could use linear combinations of Taylor Expansions to obtain a O(h^{2}) centered difference formula for f′(x):

f′(x_{0}) = \frac{f(x_{0} + h) − f(x_{0} − h)}{2h} − f^{(3)}(ξ(x_{0}))\frac{h^{2}}{6}

We also showed that the general form of 3-point difference formula is:

f′(x_{0}) ≈ \frac{2x_{0} − x_{1} − x_{2}}{(x_{0} − x_{1})(x_{0} − x_{2})}f(x_{0}) + \frac{x_{0} − x_{2}}{(x_{1} − x_{0})(x_{1} − x_{2})}f(x_{1}) + \frac{x_{0} − x_{1}}{(x_{2} − x_{0})(x_{2} − x_{1})}f(x_{2})

Error Formula = e(x_{0}) = f^{(3)}(ξ(x_{0}))\frac{(x_{0} − x_{1})(x_{0} − x_{2})}{3!}

Make a choice for x_{1} and x_{2} so that you can use the above formula to derive the same O(h^{2}) centered difference formula for f′(x):

\underline{Example} Let’s use this formula to find f′(1.8) (where f(x) = ln(x)) and show that it is more accurate than the original forward difference formula we used previously. In groups of 2 or 3 choose different values of h and use the above formula to approximate the derivative f′(1.8)

Compute an error bound for f′(1.8)

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}) (what terms have to cancel?)

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 = f′(1) − e

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

Explanation of Optimal h 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 computer produces due to way it represents numbers in memory. 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)

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.

E(h) =

Optimal value of h Let’s use the optimal value of h and compute the approximation to f′(1.8) using the forward difference approximation.

Can we always find this optimal value of h?