This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Numerical Differentiation James Keesling 1 Theoretical Error in Approximating the Derivative The most straightforward way to approximate the derivative would be to use the difference quotient used in the definition of the derivative. f ( x ) = lim n f ( x + h ) f ( x ) h For a small value of h , f ( x + h ) f ( x ) h is approximately f ( x ). On the other hand, if we experiment with this formula we observe that if we take h to be too small, we get 0. Of course, it is not the case that all derivatives are 0. What causes this error is that if h is so small that x + h = x in the way x is represented in the computer, then the numerator in the expression f ( x + h ) f ( x ) h is zero. So, what is the best value of h to use to get the most digits accurate in estimating f ( x )? The error in our formula is composed of two parts. The first and easiest to analyze is the theoretical error. The second is caused by roundoff error. Roundoff error comes from representing the numbers x and x + h as floating point numbers. It can also arise through numerical inaccuracies in calculating the function f . The theoretical error is given by a power series representation for f ( x + h ) f ( x ) h . f ( x + h ) f ( x ) h = f ( x ) + f ( x ) h + f 00 ( x ) h 2 2 +  f ( x ) h = f ( x ) + f 00 ( x ) 2 h + f 000 3! h 2 + For small values of h the error is approximately f 00 ( x ) 2 h . Obviously, the smaller h is, the more accurate the representation of f ( x ). However, there is also a roundoff error that needs to be taken into account. 2 Roundoff Error Let us suppose that when we represent the value of f ( x ) in the computer, there is an error of . The worst case in representing the difference quotient would be if the error representing 1 f ( x + h ) and the error representing f ( x ) was the same magnitude and opposite sign. Then the total error representing f ( x ) would be the following expression. E ( h ) = K h + 2 h So, while the theoretical error goes to zero as h 0, the roundoff error goes to infinity as h 0. What is the best choice of h to give us the best estimate of the derivative? We need to minimize the error E ( h ). dE ( h ) dh = K 2 h 2 If we set this equal to zero, we come up with a best h that will give us the best accuracy in estimating f ( x ). This is easily seen to be h = r 2 K ....
View
Full
Document
 Summer '08
 Kyung
 Statistics

Click to edit the document details