Sei sulla pagina 1di 23

ENGINEERING MATHEMATICS 4

(BWM 30603)

Lecture Module 5: Numerical Differentiation

Waluyo Adi Siswanto


Universiti Tun Hussein Onn Malaysia

This work is licensed under a Creative Commons Attribution 3.0 License.


Topics

First derivative
Basic first derivative
(2 point forward, 2 point backward, 3 point central)
Other first derivative formulations
(3 point forward, 3 point backward, 5 point)

Second derivative
3 point central
5 point

Lecture Module 5 BWM 30603 2


First derivative
Using Taylor's series

Taylor series expansion

h2 h3 hn n
f ( x+h)= f ( x)+h f ' ( x)+ f ' ' ( x)+ f ' ' ' ( x)+ + f ( x)
2! 3! n!

Considering only the first derivative (do not have higher derivatives or very small)

f ( x+h)= f ( x)+h f ' ( x)

Then the first derivative can be obtained:

f ( x+h) f ( x)
f ' ( x)=
h

Lecture Module 5 BWM 30603 3


First derivative
2-point forward

The derivative can be shown graphically

y The derivative can be expressed as


The slope or gradient
y ( x+h)
dy
y ' ( x)=
dx
y ( x) dy

dx y( x+h) y ( x)
y ' ( x)=
h
h
x
x ( x+h) Forward : using the point data
after the the point of concern

Lecture Module 5 BWM 30603 4


First derivative
2-point backward

The derivative can be shown graphically

y The derivative can be expressed as


The slope or gradient

dy
y ' ( x)=
dx
y ( x)

y ( xh) dy y( x) y( xh)
y ' ( x)=
dx h
h
x
( xh) x Backward : using the point data
before the the point of concern

Lecture Module 5 BWM 30603 5


First derivative
3-point central

The derivative can be shown graphically

y The derivative can be expressed as


The slope or gradient
y ( x+h)
dy
y ' ( x)=
dx
y ( x) dy

y ( xh) y( x+h) y ( xh)


y ' ( x)=
dx 2h
h h
x
( xh) x ( x+h) Central : using the points data
before and after
the the point of concern

Lecture Module 5 BWM 30603 6


Example 5-1
The motion of an particle follows an exponential function s (t)=e t

a. Calculate the velocity of the particle when the time t = 1 as you have learned in
Dynamics

b. Do the same thing, but the derivative must be conducted using


Numerical differential
> 2-point forward
> 2-point backward
> 3-point central

Lecture Module 5 BWM 30603 7


motion s (t)=e t
ds
velocity v(t)=
dt

Since in mathematics d t t If the function is complicated


e =e perhaps you will find it
dt
difficult to derive mathematically
t
then velocity v(t)=e

v(1)=2.7182818285

Lecture Module 5 BWM 30603 8


2-point forward Using small increment h=105

Lecture Module 5 BWM 30603 9


2-point backward Using small increment h=105

Lecture Module 5 BWM 30603 10


3-point central Using small increment h=105

Lecture Module 5 BWM 30603 11


First derivative
other higher formulations

3-point forward difference

y ( x+2 h) + 4 y ( x+h) 3 y ( x)
y ' ( x)=
2h

3-point backward difference

3 y ( x) 4 y( xh) + y( x2 h)
y ' ( x)=
2h

5-point difference

y ( x+2 h) + 8 y( x+h) 8 y ( xh) + y ( x2 h)


y ' ( x)=
12 h

Lecture Module 5 BWM 30603 12


Second Derivative
3-point central difference

y ( x+h) 2 y ( x) + y( xh)
y ' ' ( x)=
h2

5-point difference

y ( x+2h) + 16 y( x+h) 30 y ( x) + 16 y ( xh) y( x2 h)


y ' ' ( x)=
12 h2

Lecture Module 5 BWM 30603 13


Example 5-2
The displacement of a particle which moves along the s-axis follows a motion equation

s (t)=(2+3t )e 0.5 t

where s is in meters and t is in seconds.

Find the velocity of the particle at 10 seconds and 20 seconds


Use the following numerical derivative methods:
> 2 point forward difference
> 2 point backward difference
> 3 point central difference

Do the same if you use mathematical derivative (use SMath)

Lecture Module 5 BWM 30603 14


Lecture Module 5 BWM 30603 15
Lecture Module 5 BWM 30603 16
Lecture Module 5 BWM 30603 17
Lecture Module 5 BWM 30603 18
Example 5-3
The displacement of a particle which moves along the s-axis follows a motion equation

s (t)=(2+3t )e 0.5 t

where s is in meters and t is in seconds.

Find the acceleration of the particle at 10 seconds and 20 seconds


Use the following numerical derivative methods:
> 3 point central difference
> 5 point difference

Do the same if you use mathematical derivative (use SMath)

Lecture Module 5 BWM 30603 19


Lecture Module 5 BWM 30603 20
Lecture Module 5 BWM 30603 21
Lecture Module 5 BWM 30603 22
Lecture Module 5 BWM 30603 23

Potrebbero piacerti anche