Sei sulla pagina 1di 9

Chapter 5

NUMERICAL
INTEGRATION &
DIFFERENTIATION :
NUMERICAL
DIFFERENTIATION

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

by Lale Yurttas, Texas


A&M University

Chapter 5

HIGH ACCURACY
DIFFERENTIATION
FORMULAS

High-accuracy divided-difference formulas


can be generated by including
additional terms from the Taylor series
expansion.
f ( xi ) 2

f ( x ) f ( x ) f ( x )h
h
i 1

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 )
O ( h)
2
h
f ( xi 1 ) f ( xi ) f ( xi 2 ) 2 f ( xi 1 ) f ( xi )
2
f ( xi )

O
(
h
)
2
h
2h
f ( xi 2 ) 4 f ( xi 1 ) 3 f ( xi )
f ( xi )
O(h 2 )
2h

First Derivative
Forward finite divided difference
f ( xi 2 ) 4 f ( xi 1 ) 3 f ( xi )
f ' ( xi )
2h

Error : O(h 2 )

Backward finite divided difference


3 f ( xi ) 4 f ( xi 1 ) f ( xi 2 )
f ' ( xi )
2h

Error : O(h 2 )

Centered finite divided difference


f ( xi 2 ) 8 f ( xi 1 ) 8 f ( xi 1 ) f ( xi 2 )
f ' ( xi )
12h
by Lale Yurttas, Texas
A&M University

Chapter 5

Error : O(h 4 )
3

Example 1
Estimated the derivative of

f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2


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

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

1
I I (h2 )
[ I (h2 ) I (h1 )]
2
(h1 / h2 ) 1
h2 h1 / 2
4
1
I I (h2 ) I (h1 )
3
3
4
1
D D(h2 ) D(h1 )
3
3
For centered difference approximations
with O(h2).
f ( xi 1 ) f ( xi 1 )
D(h) f ' ( xi )
2h
by Lale Yurttas, Texas
A&M University

Chapter 5

Example 2
Estimated the first derivative of

f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2


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

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.
f ( x) f ( xi 1 )
f ( xi 1 )

2 x xi xi 1
2 x xi 1 xi 1
f ( xi )

xi 1 xi xi 1 xi 1
xi xi 1 xi xi 1

2 x xi 1 xi
xi 1 xi 1 xi 1 xi

x is the value at which you want to estimate the


derivative.
by Lale Yurttas, Texas
A&M University

Chapter 5

Example 3
The heat flux at the soil-air interface
can be computed with Fouriers law,

dT
q ( z 0) kC
dz

z 0

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

Potrebbero piacerti anche