Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Numerical Differentiation and Taylor Series Expansion in Engineering, Lecture notes of Engineering Mathematics

The applications of differentiation and integration in engineering, and focuses on the forward difference method for numerical differentiation and Taylor series expansion for approximating non-elementary functions. It also covers the finite difference approximation of higher derivatives. examples and limitations of these methods.

Typology: Lecture notes

2021/2022

Available from 08/29/2022

ggegegege
ggegegege 🇵🇭

45 documents

1 / 25

Toggle sidebar

Related documents


Partial preview of the text

Download Numerical Differentiation and Taylor Series Expansion in Engineering and more Lecture notes Engineering Mathematics in PDF only on Docsity!

CE 50 P- 2

Numerical Solutions to Engineering Problems

Module 2

Lesson 4

Numerical Differentiation

Forward Difference Method

Edgar M. Adina

Instructor

CE 50 P- 2

Numerical Solutions to Engineering Problems

Introduction

➢ Calculus is the mathematics of change. Because engineers must
continuously deal with systems and processes that change, calculus is
an essential tool of engineering.
➢ Standing in the heart of calculus are the mathematical concepts of
differentiation and integration :

Δ𝑦

Δ𝑥

=

𝑓(𝑥𝑖 + Δ𝑥) − 𝑓(𝑥𝑖)

Δ𝑥 𝑑𝑦

𝑑𝑥

=Δ𝑥 lim 0

𝑓(𝑥𝑖 + Δ𝑥) − 𝑓(𝑥𝑖)

Δ𝑥

𝐼 = න

𝑎

𝑏

𝑓(𝑥)𝑑𝑥

Introduction

➢ Integration and differentiation are closely linked processes. They are, in

fact, inversely related.

➢ Types of functions to be differentiated or integrated:

  1. Simple polynomial, exponential, trigonometric ➔ analytically
  2. Complex function ➔ numerically
  3. Tabulated function of experimental data ➔ numerically

Applications

➢ Differentiation has so many engineering applications

(heat transfer, fluid dynamics, chemical reaction kinetics,

etc…)

➢ Integration is equally used in engineering (compute work

in ME, nonuniform force in SE, cross-sectional area of a

river, etc…)

Differentiation

The finite difference becomes a derivative as Δx approaches zero.

𝜟𝒚

𝜟𝒙

=

𝒇(𝒙𝒊 + 𝜟𝒙) − 𝒇(𝒙𝒊)

𝜟𝒙 x

f x x f x

dx

dy (^) i i

x (^) 

( ) ( ) lim 0

  • − = →

Taylor Series Expansion

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

Numerical Application of Taylor Series

If f (x) and its first n+ 1 derivatives are continuous on an

interval containing x

i+ 1

and x

i

, then:

Where the remainder R

n

is defined as:

𝑓 𝑥𝑖+ 1 ≅ 𝑓 𝑥𝑖 + 𝑓

′ 𝑥𝑖 𝑥𝑖+ 1 − 𝑥𝑖 +

𝑓

′′ 𝑥𝑖

2!

𝑥𝑖+ 1 − 𝑥𝑖

2

𝑓

3 𝑥𝑖

3!

𝑥𝑖+ 1 − 𝑥𝑖

3 +... +

𝑓

𝑛 𝑥𝑖

𝑛!

𝑥𝑖+ 1 − 𝑥𝑖

𝑛

  • 𝑅𝑛

𝑅𝑛 =

𝑓

𝑛+ 1 𝜉

𝑛 + 1!

𝑥𝑖+ 1 − 𝑥𝑖

𝑛+ 1

Numerical Application of Taylor Series

➢ The series is built term by term

➢ Continuing the addition of more terms to get better

approximation we have:

𝑓 𝑥𝑖+ 1 ≅ 𝑓 𝑥𝑖

𝑓 𝑥𝑖+ 1 ≅ 𝑓 𝑥𝑖 + 𝑓

′ 𝑥𝑖 𝑥𝑖+ 1 − 𝑥𝑖

𝑓 𝑥𝑖+ 1 ≅ 𝑓 𝑥𝑖 + 𝑓

′ 𝑥𝑖 𝑥𝑖+ 1 − 𝑥𝑖 +

𝑓

′′ 𝑥𝑖

2!

𝑥𝑖+ 1 − 𝑥𝑖

2

zero order approximation

1 st order approximation

2 nd order approximation

Numerical Application of Taylor Series

Finally

where

ξ is a value of x that lies somewhere between x i and x i+ 1 .

𝒇 𝒙𝒊+𝟏 ≅ 𝒇 𝒙𝒊 + 𝒇

′ 𝒙𝒊 𝒙𝒊+𝟏 − 𝒙𝒊 +

𝒇

′′ 𝒙𝒊

𝟐!

𝒙𝒊+𝟏 − 𝒙𝒊

𝟐

𝒇

𝟑 𝒙𝒊

𝟑!

𝒙𝒊+𝟏 − 𝒙𝒊

𝟑 +... +

𝒇

𝒏 𝒙𝒊

𝒏!

𝒙𝒊+𝟏 − 𝒙𝒊

𝒏

  • 𝑹𝒏

𝑅𝑛 =

𝑓

𝑛+ 1 𝜉

𝑛 + 1!

𝑥𝑖+ 1 − 𝑥𝑖

𝑛+ 1

Taylor Series: ξ in the Remainder Term

❑ Limitations
➢ ξ is not exactly known but lies somewhere between xi and xi+ 1
➢ To evaluate R

n

, the (n+ 1 ) derivative of f (x) has to be determined.
To do this f (x) must be known
➔ if f (x) was known there would be no need to perform the Taylor series
expansion!!!
❑ Modification
R

n

= O(h

n+ 1

) the truncation error is of the order of h

n+ 1.

(h = x

i+ 1

  • x i
)
➢ If the error is O(h), halving the step size will halve the error.
➢ If the error is O(h

2

), halving the step size will quarter the error.
➢ In general, the truncation error is decreased by addition of more terms in the
Taylor series.

Forward difference approximation from Taylor series

Taylor’s theorem says that if you know the value of a function '^ f 'at a point

i x^ and all its derivatives at that point, provided the derivatives are

continuous between i

(^) x and xi + 1 , then

( ) ( ) ( )( )

( )

( − ) + 


+ =^ +  + − + +

2 1 1 1

2!

i i

i

i i i i i x x
f x
f x f x f x x x

Substituting for convenience Δ x = xi + 1 − xi

( ) ( ) ( )

( ) ( ) + 



  • = +  +

2 1 Δ 2!

Δ x

f x f x f x f x x

i i i i

( )

( ) ( ) ( ) (  )+ 

 − 

−  (^) =

x

f x

x

f x f x f x

i i i i 2!

1

( )

( ) ( )

( x )

x

f x f x f x

i i i +  

−  (^) =

0

1

Forward Difference Approximation

( )

( ) ( )

x

f x x f x

x

f x

Δ

Δ

Δ 0

lim + −

 =

For a finite '^ Δ x '

( )

( ) ( )

x

f x x f x

f x

+  −

 

x x+Δx

f(x)

Figure 1 Graphical Representation of forward difference approximation of first derivative.

Graphical Representation Of Forward

Difference Approximation

Example 1

The velocity of a rocket is given by

( ) 9. 8 , 0 30 14 10 2100

14 10 2000 ln 4

4

−    

  

 −

 = t t t

t

where (^) ' ν ' is given in m/s and (^) ' t ' is given in seconds.

a) Use forward difference approximation of the first derivative of to

calculate the acceleration at. Use a step size of.

b) Find the exact value of the acceleration of the rocket.

c) Calculate the absolute relative true error for part (b).

ν ( ) t

t = 16 s Δ t = 2 s

Example 1 Cont.

Solution

( )

( ) ( )

t
t t
a t

i i i

 + 1 

ti = 16

Δ t = 2

18

16 2

1

=

= +

t (^) i + = ti + t

( )

( ) ( )

2

18 16 16

 −  a

Example 1 Cont.

( ) ( )

  1. 8 ( 18 ) 14 10 210018

14 10 18 2000 ln 4

4

^ − 

  

 −

  =

= 453. 02 m/s

( )

( )

9. 8 ( 16 )

14 10 210016

14 10 16 2000 ln 4

4

−  

 

 −

  =

= 392. 07 m/s

Hence

( )

( ) ( )

2

18 16 16

 −  a

2

  1. 02 − 392. 07 

2  30. 474 m/s

Example 1 Cont.

The exact value of a (^16 ) can be calculated by differentiating

( ) t t

t 9. 8 14 10 2100

14 10 2000 ln 4

4

^ − 

  

 −

 = as ( )  ν ( ) t 

dt
d
a t =

b)

Knowing that  ( ) t

t dt

d 1 ln = and 2

1 1

dt t t

d = −  

  

( ) 9. 8 14 10 2100

14 10

14 10

14 10 2100 2000 4

4

4

4

− 

 

 

 

 −

 

 

 

 

 −

dt t

t d at

( )

( )

( 2100 ) 9. 8 14 10 2100

14 10 1 14 10

14 10 2100 2000 4 2

4

4

4 − − 

 −

 − 

 

 

 

 −

t

t

t

t

200 3

4040 29. 4

− +

− −

( )

( )

200 3 ( 16 )

4040 29. 416 16 − +

− − a = = 𝟐𝟗. 𝟔𝟕𝟒m/s

𝟐

Example 1 Cont.

The absolute relative true error is

100 TrueValue

True Value-ApproximateValue  t = x

100

  1. 674

  2. 674 30. 474 x

= 2. 6967 %

Finite Difference Approximation of Higher Derivatives

One can use Taylor series to approximate a higher order derivative.

For example, to approximate f^ ( )^ x , the Taylor series for

( ) ( ) ( )( )

( ) ( )

( ) ( ) + 





  • = +  +

2 3 2 2 Δ 3!

2 Δ 2!

2 Δ x

f x x

f x f x f x f x x

i i i i i

where xi^ + 2 = xi +^2 Δ x

( ) ( ) ( )( )

( ) ( )

( ) ( ) 

2 3 1 2! 3!

x

f x x

f x f x f x f x x

i i i i i

  +



  • = +   +
where x x x

i i

Δ

1

= −

Finite Difference Approximation of Higher Derivatives

Subtracting 2 times equation ( 4 ) from equation ( 3 ) gives

( ) ( ) ( ) ( )( ) ( )( ) 

2 3 f xi 2 2 f xi 1 f xi f xi Δ x f xi Δ x − =− +  + 

( )

( ) ( ) ( )

( )

− ( )( )+ 

− +  (^) =

f x x x

f x f x f x f x i

i i i i Δ Δ

2

2

2 1

( )

( ) ( ) ( )

( )

( x )

x

f x f x f x f x

i i i i^0 Δ Δ

2

2

2 1

− +  (^) 

    • ( 5 )

Example 2

The velocity of a rocket is given by

( ) 9. 8 , 0 30 14 10 2100

14 10 2000 ln 4

4

−    

  

 −

 = t t t

t

Use forward difference approximation of the second derivative of to

calculate the “pull” or “jerk” at. Use a step size of.

ν ( ) t

t = 16 s Δ t = 2 s

(^23) http://numericalmethods.eng.usf.edu

Example 2

Solution ( )

( ) ( ) ( )

( )

2

t
t t t
j t

i i i i

− +

 +  +  = 16 ti

18

16 2

1

=

= +

t (^) i + = ti + t (^ )

( )

20

16 2 2

2 2

=

= +

t (^) i + = ti +  t

( )

( ) ( ) ( )

( )

2 2

20 2 18 16 16

 −  +  j

t = 2

( ) ( )

  1. 8 ( 20 ) 14 10 210020

14 10 20 2000 ln 4

4

−  

  

 −

  = = 517. 35 m/s

( ) ( )

  1. 8 ( 18 ) 14 10 210018

14 10 18 2000 ln 4

4

−  

  

 −

  = = 453. 02 m / s

( ) ( )

  1. 8 ( 16 ) 14 10 210016

14 10 16 2000 ln 4

4

−  

  

 −

  = = 392. 07 m/s

( )

( )

4

  1. 35 2 453. 02 392. 07 16

− + j

3  0. 84515 m/s

(^24) http://numericalmethods.eng.usf.edu

Example 2

The exact value of j (^16 ) can be calculated by differentiating

( ) t t

t 9. 8 14 10 2100

14 10 2000 ln 4

4

^ − 

  

 −

  =

twice as ( )  ν ( ) tdt

d

a t = and ( )^  a^ ( )^ t 

dt
d
j t =

Knowing that  ( ) t

t dt

d 1 (^) ln = and 2

1 1

dt t t

d =−  

  

( ) 9. 8 14 10 2100

14 10

14 10

14 10 2100 2000 4

4

4

4

− 

 

 

 

 −

 

 

 

 

 −

dt t

t d at

t

t

200 3

4040 29. 4

− +

− − ( ) (^) = ( )

( 2100 ) 9. 8 14 10 2100

14 10 1 14 10

14 10 2100 2000 4 2

4

4

4

− − 

 −

 − 

 −

t

t

(^25) http://numericalmethods.eng.usf.edu

Example 2

( ) (^)  ( )

2 ( 200 3 )

18000

t

a t dt

d j t

− +

=

= ( )

3

2

  1. 77909 m/s

[ 200 3 ( 16 )]

18000 16

=

− +

j =

The absolute relative true error is

100

  1. 77909

  2. 77909 0. 84515 

−  t = = 8. 4797 %

Similarly it can be shown that