0% found this document useful (0 votes)
65 views8 pages

(2-1) Truncation Error and Taylor Series

numerical methods
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views8 pages

(2-1) Truncation Error and Taylor Series

numerical methods
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

A Lecture on

The Taylor Series


…in GEM602: Numerical Methods for Graduate Students

Dr. Ian Dominic F. Tabañag


Instructor
Computation Theory
…essential concept…

How does a CPU compute the following functions for a specific x


value?
cos(x) sin(x) ex log(x) etc.

• 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.

• 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.

Chapra, S. C. Applied Numerical Methods with MATLAB for Engineers and Scientists, 6th ed., McGraw-Hill: New York 2010
The Taylor Series
…nth order approximation…

f ' ( xi ) f " ( xi ) f ( n ) ( xi )
f ( xi +1 )  f ( xi ) + ( xi +1 − xi ) + ( xi +1 − xi ) +  +
2
( xi +1 − xi ) n + Rn
1! 2! n!

The Reminder term, Rn, accounts for all terms from (n+1) to
infinity.
f ( n +1) ( ) ( n +1)
Rn = h
(n + 1)!

Define the step size as h=(xi+1- xi), the series becomes:


f ' ( xi ) f " ( xi ) 2 f ( n ) ( xi ) n
f ( xi +1 )  f ( xi ) + h+ h ++ h + Rn
1! 2! n!

Chapra, S. C. Applied Numerical Methods with MATLAB for Engineers and Scientists, 6th ed., McGraw-Hill: New York 2010
The Taylor Series
…nth order approximation…

Any smooth function can be approximated as a polynomial.


Take x = xi+1 Then f(x) ≈ f(xi) zero order approximation

f ( x)  f ( xi ) + f ' ( xi )( x − xi ) first order approximation

Second order approximation: • Each additional term will


contribute some improvement to
f ' ( xi ) f " ( xi ) the approximation. Only if an
f ( x)  f ( xi ) + ( x − xi ) + ( x − xi ) 2
1! 2! infinite number of terms are
added will the series yield an
nth order approximation: exact result.

f ' ( xi ) f " ( xi ) f ( n ) ( xi ) • In most cases, only a few terms


f ( x)  f ( xi ) + ( x − xi ) + ( x − xi ) +  +
2
( x − xi ) n + Rn will result in an approximation
1! 2! n!
that is close enough to the true
value for practical purposes

Chapra, S. C. Applied Numerical Methods with MATLAB for Engineers and Scientists, 6th ed., McGraw-Hill: New York 2010
The Taylor Series Example:
…nth order approximation… computing f(x) = ex using
Taylor Series expansion
f ' ( xi ) f " ( xi ) f ( n ) ( xi )
f ( xi +1 )  f ( xi ) + ( xi +1 − xi ) + ( xi +1 − xi ) +  +
2
( xi +1 − xi ) n + Rn
1! 2! n!

Choose x = xi+1 and xi = 0 Then f(xi+1) = f(x) and (xi+1 – xi) = x

Since First Derivative of ex is also ex :


(2.) (ex )” = ex (3.) (ex)”’ = ex, … (nth.) (ex)(n) = ex

As a result we get:
2 3 n
x x x Looks familiar?
e = 1 +x + + + ... +
x
Maclaurin series for ex
2! 3! n!
Chapra, S. C. Applied Numerical Methods with MATLAB for Engineers and Scientists, 6th ed., McGraw-Hill: New York 2010
The Taylor Series Yet another example:
…nth order approximation… computing f(x) = cos(x) using
Taylor Series expansion

Choose x=xi+1 and xi=0 Then f(xi+1) = f(x) and (xi+1 – xi) = x
Derivatives of cos(x):
(1.) (cos(x) )’ = -sin(x) (2.) (cos(x) )” = -cos(x),
(3.) (cos(x) )”’ = sin(x) (4.) (cos(x) )”” = cos(x),
……
As a result we get:

x2 x4 x6
cos x = 1 − + − + 
2! 4! 6!
Chapra, S. C. Applied Numerical Methods with MATLAB for Engineers and Scientists, 6th ed., McGraw-Hill: New York 2010
The Taylor Series
…nth order approximation…
Notes on Taylor expansion:

• Each additional term will contribute some improvement to the


approximation. Only if an infinite number of terms are added
will the series yield an exact result.

• In most cases, several terms will result in an approximation


that is close enough to the true value for practical purposes

• Reminder value R represents the truncation error


• The order of truncation error is hn+1 ➔ R=O(hn+1),
If R=O(h), halving the step size will halve the error.
If R=O(h2), halving the step size will quarter the error.

Chapra, S. C. Applied Numerical Methods with MATLAB for Engineers and Scientists, 6th ed., McGraw-Hill: New York 2010
The Taylor Series
Numerical Methods for Graduate Students

Any Questions?
Comments? -End of Presentation-
Thank you for your attention!
IMAGE ATTRIBUTION:
1. Title Slide – [broen error fatal glitch], Jorge Mario Zuleta, Pexels License, available online at:
https://www.pexels.com/photo/broken-error-fatal-error-glitch-114831/ https://www.pexels.com/photo/broken-error-
fatal-error-glitch-114831/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy