Professional Documents
Culture Documents
Taylor Series
© McGraw Hill 1
TRUNCATION ERRORS 1
dv v v(ti 1 ) v(ti )
dt t ti 1 ti
Access the text alternative for slide images.
© McGraw Hill 2
TRUNCATION ERRORS 2
dv v(ti 1 ) v(ti )
dt ti 1 ti
Key questions:
Given t = ti+1 − ti
• How good is the approximation? Error.
• What is benefit for reducing t? Convergence.
© McGraw Hill 3
TAYLOR’S THEOREM
If a function f and its first n + 1 derivatives are continuous on
an interval containing xi and xi+1 = xi + h, then the value of the
function at xi+1 is given by
f ( xi ) 2
f ( xi 1 ) f ( xi ) f ( xi )h h
2!
f (3) ( xi ) 3 f ( n ) ( xi ) n
h h Rn
3! n!
Where
f ( n 1) ( ) n 1
Rn h
(n 1)!
© McGraw Hill 4
Taylor Series
Figure 4.1
Access the text alternative for slide images.
© McGraw Hill 5
Truncation Errors and the Taylor Series
• Non-elementary functions such as trigonometric,
exponential, and others are expressed in an approximate
fashion using Taylor series when their values,
derivatives, and integrals are computed.
• Any smooth function can be approximated as a
polynomial. Taylor series provides a means to predict
the value of a function at one point in terms of the
function value and its derivatives at another point.
© McGraw Hill 6
Taylor Series Example
To get the cos(x) for small x:
x2 x4 x6
cos x 1
2! 4! 6!
If x = 0.5, the exact value is 0.877582562. The approximation is
cos(0.5) = 1 − 0.125 + 0.0026041 − 0.0000127 + …
= 0.877582465
From the supporting theory, for this series, the error is no greater than the
first omitted term.
x8
for x 0.5 9.68812 108
8!
The true error is 0.877582562 0.877582465 9.66126 108
© McGraw Hill 7
The Taylor Series Remainder
nth order approximation
f
f xi 1 f xi f xi xi 1 xi
xi 1 xi
2
2!
f (n)
xi 1 xi Rn
n
n!
f ( n 1) ( ) ( n 1)
Rn h
( n 1)!
• Remainder term, Rn, accounts for all terms from (n + 1)
to infinity.
© McGraw Hill 8
O(h) Notation
f ( xi ) 2
f ( xi 1 ) f ( xi ) f ( xi )h h
2!
f (3) ( xi ) 3 f ( n ) ( xi ) n
h h Rn
3! n!
where
Rn O (h n 1 )
© McGraw Hill 9
Summary of the Taylor Series Error
• is not known exactly, lies somewhere between xi 1 xi .
• Need to determine f n 1 ( x).
• To do this you need f (x).
• If we knew f (x), there wouldn’t be any need to perform the
Taylor series expansion!
• However, R O(h n 1 ), (n 1) th order, the order of truncation
error is h n 1.
• O(h), halving the step size will halve the error.
2
• O ( h ), halving the step size will quarter the error.
© McGraw Hill 10
Taylor Series Error
• Truncation error is decreased by addition of terms to
the Taylor series.
• If h is sufficiently small, only a few terms may be
required to obtain an approximation close enough to
the actual value for practical purposes.
© McGraw Hill 11
ESTIMATING THE TRUNCATION ERROR OF
THE VELOCITY APPROXIMATION OF THE
DERIVATIVE OF THE VELOCITY
v(ti )
v(ti 1 ) v(ti ) v (ti ) (ti 1 ti ) (ti 1 ti ) 2 Rn
2!
v(ti 1 ) v(ti ) R1
v(ti )
ti 1 ti ti 1 ti
First-order Truncation
Approximation error
R1 v( )
(ti 1 ti ) O(ti 1 ti ) O(h)
ti 1 ti 2!
© McGraw Hill 12
NUMERICAL DIFFERENTIATION
First forward divided difference:
f ( xi 1 ) f ( xi )
f ( xi ) O ( h)
h
First backward divided difference:
f ( xi ) f ( xi 1 )
f ( xi ) O ( h)
h
© McGraw Hill 14
CENTERED SECOND DIVIDED
DIFFERENCE
f ( xi 1 ) 2 f ( xi ) f ( xi 1 )
f ( xi ) O(h 2 )
h2
f ( xi 1 ) f ( xi ) f ( xi ) f ( xi 1 )
f ( xi ) h h
h
© McGraw Hill 15
TWO-DIMENSIONAL TAYLOR
SERIES
f ( xi 1 , yi 1 ) f ( xi , yi )
f f
( xi 1 xi ) ( yi 1 yi )
x y
1 2 f 2 f 2 f 2
2 ( xi 1 xi ) 2
2
( xi 1 xi )( yi 1 yi ) 2 ( yi 1 yi )
2! x xy y
© McGraw Hill 16
Error Propagation
Figure 4.7
Access the text alternative for slide images.
© McGraw Hill 17
TRADEOFF BETWEEN ROUND-OFF &
TRUNCATION ERROR
Figure 4.8
Access the text alternative for slide images.
© McGraw Hill 18