You are on page 1of 8

ME – 310 NUMERICAL METHODS

Taylor series
If a function f (x) and all its derivatives exist at a point x = x 0, the function f (x) can
be represented by a power series in powers of (x - x 0).

(x - x 0 ) 2 (x - x 0 ) n
f (x) = f (x 0 ) + (x - x 0 ) f ' (x 0 ) + f ' ' (x 0 ) + ... + f (n)
(x 0 ) + R
2! n!
(x - x 0 ) n +1 (n +1)
R= f ( ξ)
(n + 1) !
Set x – x0 = ∆ x :

(∆x)2 (∆x)n (n)


f=
(x) f (x 0 ) + ∆x f '(x 0 ) + f ''(x 0 ) + ... + f (x 0 ) + R
2! n!

(∆x)n+1
R = f (n+1) (ξ )
(n + 1) !

Prof. Dr. Faruk Arınç Spring 2010


ME – 310 NUMERICAL METHODS

Taylor series

In another form, substitute x - x 0 = h

h2 hn (n)
f (x)= f (x 0 ) + h f '(x 0 ) + f ''(x 0 ) + ... + f (x 0 ) + R
2! n!

hn+1
R = f (n+1) (ξ )
(n + 1) !

In another form, substitute x = x 0 + h

h2 hn (n)
f (x 0 + h)= f (x 0 ) + h f '(x i ) + f ''(x i ) + ... + f (xi ) + R
2! n!

hn+1
R = f (n+1) (ξ )
(n + 1) !
Prof. Dr. Faruk Arınç Spring 2010
ME – 310 NUMERICAL METHODS

Approximations with different number of terms

f(x)
f(x)

Three terms
f(x0+h) = f(x0) + h f ’(x0) + h2/2 f ’’(x0)

Two terms
f(x0+h) = f(x0) + h f ’(x0)

One term
f(x0+h) = f(x0)

x0 x0+h x
h
Prof. Dr. Faruk Arınç Spring 2010
ME – 310 NUMERICAL METHODS

Example

1
Consider the function: f (x) =
1- x

Taylor Series expansion around a chosen point x 0:

(x - x 0 )2 (x - x 0 )3
f (x) =+
f (x 0 ) (x - x 0 ) f '(x 0 ) + f ''(x 0 ) + f '''(x 0 ) + ...
2! 3!
(x - x 0 )n (n) (x - x 0 )n+1 (n+1)
... + f (x 0 ) + f (ξ ) , x0 < ξ < x
n! (n + 1) !

1 2
Derivatives: f ' (x 0 ) = f ' ' (x 0 ) =
(1 - x 0 ) 2 (1 - x 0 ) 3

Prof. Dr. Faruk Arınç Spring 2010


ME – 310 NUMERICAL METHODS

Approximations to f(x):

1
One term, f (x) ≅ Error = (x - x 0 ) f ' (ξ )
First Order 1- x0

1 (x - x 0 ) (x - x 0 ) 2
Two terms, f (x) ≅ + Error = f ' ' (ξ )
Second Order 1 - x 0 (1 - x 0 ) 2 2!

Three terms, 1 (x - x 0 ) (x - x 0 ) 2 (x - x 0 ) 3
f (x) ≅ + 2
+ Error = f ' ' ' (ξ )
Third Order 1 - x 0 (1 - x 0 ) (1 - x 0 ) 3 3!

Prof. Dr. Faruk Arınç Spring 2010


ME – 310 NUMERICAL METHODS

Example: x0 = 1.6. Estimate f(2) and find true and estimated errors

x f(x) Estimation with True Error Estimated Error


one term
ξ = 1.6 ξ=2

2 -1.0 -0.55556 0.44444 44.4 % Max Min


0.74 0.16

True Error: Etrue = f(x) - P1(x)

f(x) - P1(x)
True Relative Error: Etrue = *100 in percent
f(x)

Estimated Error: Eest = (x - x 0 ) f '(ξ )

Prof. Dr. Faruk Arınç Spring 2010


ME – 310 NUMERICAL METHODS

-0.5

-1

-1.5

-2

-2.5

-3

-3.5

-4 1/(1-x)
-1/0.6
-1/0.6+(x-1.6)/0.6**2
-4.5 -1/0.6+(x-1.6)/(0.6)**2+(x-1.6)**2/(-0.6)**3

-5

-5.5
1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2

Error Calculation: Find the error at x = 2


Prof. Dr. Faruk Arınç Spring 2010
ME – 310 NUMERICAL METHODS

Taylor Series expansion of a function of two variables, f(x,y), around (x 0,y0)

∂f ∂f
f (x,y) =
f (x 0 ,y0 ) + (x - x 0 ) + (y - y0 ) +
∂x x0 ,y 0 ∂y x0 ,y 0

1  2 ∂ f
2
∂ 2f ∂ 2f 
(x - x 0 ) + (y - y0 ) 2
+ 2 (x - x 0 ) (y - y0 ) 
2!  ∂x 2 ∂y 2 ∂x ∂y x ,y 
 x0 ,y 0 x0 ,y 0 0 0 

+ ...

Note that these expansions are valid within a radius of convergence, r.

For one-variable case: (x - x 0 ) < r

Prof. Dr. Faruk Arınç Spring 2010

You might also like