Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Numerical Differentiation

© McGraw Hill 1
Numerical Differentiation

• Notion of numerical differentiation has been introduced


before. In this chapter more accurate formulas that
retain more terms will be developed.

© McGraw Hill 2
© McGraw Hill 3
© McGraw Hill 4
High Accuracy Differentiation Formulas 1

• High-accuracy divided-difference formulas can be


generated by including additional terms from the Taylor
series expansion.
f ( xi ) 2
f ( xi 1 )  f ( xi )  f ( xi )h  h 
2
f ( xi 1 )  f ( xi ) f ( xi )

f ( xi )   h  O(h 2 )
h 2
f ( xi  2 )  2 f ( xi 1 )  f ( xi )
f ( xi )  2
 O ( h) [recall Eq. (4.24)]
h
f ( xi 1 )  f ( xi ) f ( xi  2 )  2 f ( xi 1 )  f ( xi )
f ( xi )   2
h  O ( h 2
)
h 2h
 f ( xi  2 )  4 f ( xi 1 )  3 f ( xi )
f ( xi )   O(h 2 )
2h
© McGraw Hill 5
High Accuracy Differentiation Formulas 2

• Inclusion of the 2nd derivative term has improved the


accuracy to O(h 2 ).

• Similar improved versions can be developed for the


backward and centered formulas as well as for the
approximations of the higher derivatives.

© McGraw Hill 6
© McGraw Hill 7
Example 1

© McGraw Hill 8
9

Example 2

© McGraw Hill 9
Example 3

© McGraw Hill 10
Richardson Extrapolation 1

There are two ways to improve derivative estimates when


employing finite divided differences:
• Decrease the step size, or,
• Use a higher-order formula that employs more points.
A third approach, based on Richardson extrapolation,
combines two derivative estimates to compute a third,
more accurate approximation.
This is very similar to the Richardson extrapolation
method for integration from Chapter. 22.

© McGraw Hill 11
Richardson Extrapolation 2

Integral estimate I by the formula [Eq. (22.4)]


1
I  I (h2 )  [ I (h2 )  I (h1 )]
(h1 / h2 )  1
2

h2  h1 / 2
4 1
I  I (h2 )  I (h1 )]
3 3
In a similar fashion, integral Eq. can be written for derivatives as

4 1
D  D(h2 )  D(h1 )]
3 3
• For centered difference approximations with O(h 2 ).
The application of this formula yield a new derivative
estimate of O(h 4 ).

© McGraw Hill 12
Derivatives of Unequally Spaced Data
• Data from experiments or field studies are often collected at
unequal intervals. One way to handle such data is to differentiate
a 2nd-order Lagrange interpolating polynomial fit to three points:

2 x  xi  xi 1
f ( x)  f ( xi 1 )
 xi 1  xi   xi 1  xi 1 
2 x  xi 1  xi 1
 f ( xi )
 xi  xi 1   xi  xi 1 
2 x  xi 1  xi
 f ( xi 1 )
 xi 1  xi 1   xi 1  xi 

where x is the value at which you want to estimate the derivative.

© McGraw Hill 13
Derivatives and Integrals for Data with
Errors

Figure 23.5 Illustration of how small data errors are amplifi ed by numerical differentiation:
(a) data with no error, (b) data modifi ed slightly, (c) the resulting numerical
differentiation of curve (a), and (d) the resulting differentiation of curve (b) manifesting
increased variability. In contrast, the reverse operation of integration [moving from (d) to
(b) by taking the area under (d)] tends to attenuate or smooth data errors

Access the text alternative for slide images

© McGraw Hill 14

You might also like