Scientific Computing: Gopalakrishnan E. A

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 44

Scientific Computing

Gopalakrishnan E. A.
Numerical methods to solve ODEs
A freely falling particle

• Consider a freely falling particle of mass


“m”. We need to determine the velocity of
the particle at any time “t”.
Mathematical Model
dv
m  F
dt

F  F g  Fd

Fg  mg

Fd  cd v 2
Mathematical Model

2
dv c v
g d
dt m
How can we solve

• Analytical Method
• Numerical Method

2
dv cd v
g
dt m
How can we solve

• Analytical Method

dv cd v 2 dv  cd v 2 
g  g 1  
dt m dt  mg 

dv
 gdt
 cd v 2
mg
1   vt 
 mg  cd
How can we solve

• Analytical Method

dv
 gdt z v
vt
 v  2

1  2  dz  dv
 vt  vt

dz
vt  gdt
 1 z 
2
How can we solve

• Analytical Method
dz dz
vt
 1 z 
2
 gdt  vt  1  z 2    gdt

dz
vt   gt  C dz
  1 z2 
1

 1 z 
2 tanh ( z)
How can we solve

• Analytical Method
gt   gt  
1
tanh ( z )   D v(t )  vt  tanh    E 
vt   vt  

v(0)  0 E0

 gt 
v(t )  vt tanh  
 vt 
Solution

Time (t) Velocity (V)


0 0
2 18.7292
4 33.118
6 42.0762
8 46.9575
10 49.4214

m  68.1kg
g  9.81 m s 2
cd  0.25 kg m
Numerical Method

• Euler Method
dv
 f ( v, t )
dt
dv v (t  t )  v (t )
  f ( v, t )
dt t

v (t  t )  v (t )  t * f (v, t )
Numerical Method

• Euler Method
Numerical Method

• Euler Method

Time (t) Velocity (V)


0 0
2 19.62
4 36.4137
6 46.2983
8 50.1802
10 51.3213
12 51.6008
Error analysis for Euler method

• Truncation Error
 

h2 1 h3 2 h n n 1
Et  f (ti , yi )  f (ti , yi )  .........  f (ti , yi )  O (h n 1 )
2! 3! n!

Ea  O(h 2 )
Stability of Euler method

• A numerical solution is said to be unstable if errors grow exponentially for a


problem for which there is a bounded solution. The stability of a particular
application can depend upon three factors: the differential equation, the
numerical method, and the step size.
Stability of Euler method
dy y  y0e at
  ay
dt
Stability of Euler method
dy y  y0e at
  ay
dt
Stability of Euler method
dy y  y0e at
  ay
dt
Stability of Euler method
dy y  y0e at
  ay
dt

dy
yi 1  yi  h yi 1  yi  ayi h
dt

yi 1  yi (1  ah) (1  ah)  1

ah  2 h2
a
Modifications in Euler Method

• Heun’s Method
yi01  yi  hf (ti , yi ) Prediction Equation

yi' 1  f (ti 1 , yi01 )

f (t , y )  f (t , y 0
i 1 )
y 
' i i i 1 Corrector Equation
2

You might also like