che 555 numerical differentiation
TRANSCRIPT
by Lale Yurttas, Texas A&M University
Chapter 5 1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 5NUMERICAL
INTEGRATION & DIFFERENTIATION :
NUMERICAL DIFFERENTIATION
2
HIGH ACCURACY DIFFERENTIATION
FORMULAS• High-accuracy divided-difference
formulas can be generated by including additional terms from the Taylor series expansion.
)(2
)(3)(4)()(
)(2
)()(2)()()()(
)()()(2)()(
)(2)()()()(
2)()()()(
212
22
121
212
21
21
hOh
xfxfxfxf
hOhh
xfxfxfh
xfxfxf
hOh
xfxfxfxf
hOhxfh
xfxfxf
hxfhxfxfxf
iiii
iiiiii
iiii
iiii
iiii
First Derivative • Forward finite divided difference
• Backward finite divided difference
• Centered finite divided difference
by Lale Yurttas, Texas A&M University
Chapter 5 3
)(:2
)(3)(4)()(' 212 hOErrorh
xfxfxfxf iiii
)(:12
)()(8)(8)()(' 42112 hOErrorh
xfxfxfxfxf iiiii
)(:2
)()(4)(3)(' 221 hOErrorh
xfxfxfxf iiii
Example 1Estimated the derivative of
at x=0.5 using high-accuracy formulas of finite divided differences and step size of h = 0.25, the true value of -0.9125.
by Lale Yurttas, Texas A&M University
Chapter 5 4
2.125.05.015.01.0)( 234 xxxxxf
by Lale Yurttas, Texas A&M University
Chapter 5 5
RICHARDSON EXTRAPOLATION
• 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, uses two derivative estimates t compute a third, more accurate approximation.
by Lale Yurttas, Texas A&M University
Chapter 5 6
)(31)(
34
)(31)(
34
2/
)]()([1)/(
1)(
12
12
12
12221
2
hDhDD
hIhII
hh
hIhIhh
hII
For centered difference approximations with O(h2).
hxfxfxfhD ii
i 2)()()(')( 11
Example 2Estimated the first derivative of
at x=0.5 using Richardson Extrapolation and step sizes of h1 = 0.5 and h2 = 0.25. The true value of -0.9125.
by Lale Yurttas, Texas A&M University
Chapter 5 7
2.125.05.015.01.0)( 234 xxxxxf
by Lale Yurttas, Texas A&M University
Chapter 5 8
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 fit a second-order Lagrange interpolating polynomial.
x is the value at which you want to estimate the derivative.
iiii
iii
iiii
iii
iiii
iii
xxxxxxxxf
xxxxxxxxf
xxxxxxxxfxf
111
11
11
11
111
11
2)(
2)(2)()(
Example 3The heat flux at the soil-air interface can be computed with Fourier’s law,
Where q = heat flux (W/m2), k = coefficient of thermal diffusivity in soil (=3.5 x 10-7 m2/s), ρ = soil density (=1800 kg/m3), and C = soil specific heat (=840 J/(kg.oC)). Use numerical differentiation to evaluate the gradient at the soil-air interface and employ this estimate to determine the heat flux into the ground.
by Lale Yurttas, Texas A&M University
Chapter 23 9
0
)0(
zdz
dTCkzq