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

NME-Methods For ODEs

This document discusses numerical methods for solving ordinary differential equations (ODEs). It introduces Euler's method, Taylor's methods, and Runge-Kutta (RK) methods. Euler's method and its stability issues are demonstrated on an example of radioactive decay. Taylor's second-order method and RK fourth-order method are also shown to more accurately solve examples compared to Euler's method.

Uploaded by

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

NME-Methods For ODEs

This document discusses numerical methods for solving ordinary differential equations (ODEs). It introduces Euler's method, Taylor's methods, and Runge-Kutta (RK) methods. Euler's method and its stability issues are demonstrated on an example of radioactive decay. Taylor's second-order method and RK fourth-order method are also shown to more accurately solve examples compared to Euler's method.

Uploaded by

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

Numerical Methods in

Engineering
Methods for ODEs
By
Dr. Rizwan Ahmed
Department of Nuclear Engineering
Pakistan Institute of Engineering and Applied Sciences
Topics
 Numerical Methods for ODEs
 Euler’s method
 Taylor’s methods
 RK methods

 Reference:
 Chapter 5, R. L. Burden and J. D. Faires, Numerical
Analysis, 9th Edition, PWS publishing company, 2011.
Numerical Solution of Differential Equations
 Differential Equation
dy
 f (t , y )
 Euler’s Method dt
 Slope can be approximated by chord length
dy yi 1  yi

dt h
yi 1  yi
 f (ti , yi )
h
yi 1  yi  hf (ti , yi )
Numerical Solution of Differential Equations
 Example:
 Radioactive Decay
dN
 N N (0)  1,   1
dt
 Euler’s Formula

N i 1  N i
 N i
h
N i 1  N i  h(N i )
Euler’s Method
1.2

yi 1  yi  hf (ti , yi )
yi 1  yi  h( yi )
1

0.8
No. of Nuclei

Y
0.6
Y(exact)

0.4

0.2

0
0 0.5 1 1.5 2 2.5
time
Numerical Stability (Euler’s Method)
1.5
Y(0.5)
Y(1.5)
Y(2.0)
1
Y(exact)

0.5
Y

0
0 2 4 6 8 10

-0.5

-1

-1.5 Time
Example

dy
  y ; y (0)  1
dt
Using Euler’s Backward Method

yn 1  yn  hf (tn 1 , yn 1 )
yn 1  yn  h( yn 1 )
yn
yn 1 
1  h
7
Euler’s Backward Method
1.2

0.8
No. of Nuclei

Y(exact)
0.6
EBF

0.4

0.2

0
0 0.5 1 1.5 2 2.5
time
Euler’s Forward and Back ward Methods
1.2

0.8
No. of Nuclei

Y
0.6 Y(exact)
EBF

0.4

0.2

0
0 0.5 1 1.5 2 2.5
time
Taylor’s Methods
 Taylor’s Method of order two

h2
yn 1  yn  hf (tn , yn )  f (tn , yn )
2!

 Taylor’s Method of order Four

h2 h3 h4
yn 1  yn  hf (tn , yn )  f (tn , yn )  f (tn , yn )  f (tn , yn )
2! 3! 4!

10
Example: 2nd order Taylor’s Method
dy
  y y (0)  100,   1
dt

time yexact y (2nd Order) error


0 100 100 0
0.1 90.484 90.5 0.0162582
0.2 81.873 81.9025 0.0294247
0.3 74.082 74.121763 0.0399404
0.4 67.032 67.080195 0.0481905
0.5 60.653 60.707577 0.0545106
0.6 54.881 54.940357 0.0591932
0.7 49.659 49.721023 0.0624925
0.8 44.933 44.997526 0.0646293
0.9 40.657 40.722761 0.0657948
1 36.788 36.854098 0.0661544

11
Taylor’s Method 2nd Order
120

100

80

Yexact
N(t)

60
Y(2nd)

40

20

0
0 0.5 1 1.5 2 2.5
time
Numerical Solution of Differential Equations
 Runge-Kutta Methods
 RK-2 Method/ Midpoint Method

yi 1  yi  hf (ti 1/ 2 , yi 1/ 2 )


 Notation
k1  hf (ti , yi )
h k1
k 2  hf (ti  , yi  )
2 2
yi 1  yi  k 2
 Error

yi 1  yi  k 2  O(h 3 )
13
Numerical Solution of Differential Equations
 Runge Kutta (4th order) Method
1
yi 1  yi   K1  2 K 2  2 K 3  K 4 
6
K1  hf (ti , yi )
h K1
K 2  hf (ti  , yi  )
2 2
h K2
K 3  hf (ti  , yi  )
2 2
K 4  hf (ti  h, yi  K 3 )

14
Runge-Kutta Methods
Modified Euler’s Method

h
yi 1  yi   f (ti , yi )  f (ti 1 , yi  hf (ti , yi )) 
2

Heun’s Method

h 2 2 
yi 1  yi   f (ti , yi )  3 f (ti  h, yi  hf (ti , yi )) 
4 3 3 

Both are classified as Runge-Kutta methods of order two, the order of


their local truncation error is h3.
Runge Kutta (4th order) Method

1
yi 1  yi   K1  2 K 2  2 K 3  K 4 
6

K1  hf (ti , yi )
h K1
K 2  hf (ti  , yi  )
2 2
h K2
K 3  hf (ti  , yi  )
2 2
K 4  hf (ti  h, yi  K 3 )

16
Example: RK-4 Mehtod
dy
  y y (0)  100,   1
dt
time yexact K1 K2 K3 K4 Y Error
0 100 100 0
0.1 90.484 -10 -9.5 -9.525 -9.0475 90.48375 -8.1964E-06
0.2 81.873 -9.048375 -8.595956 -8.618577 -8.18652 81.87309 -1.48328E-05
0.3 74.082 -8.187309 -7.777944 -7.798412 -7.40747 74.08184 -2.01319E-05
0.4 67.032 -7.408184 -7.037775 -7.056295 -6.70255 67.03203 -2.42882E-05
0.5 60.653 -6.703203 -6.368043 -6.384801 -6.06472 60.65309 -2.74711E-05
0.6 54.881 -6.065309 -5.762044 -5.777207 -5.48759 54.88119 -2.98282E-05
0.7 49.659 -5.488119 -5.213713 -5.227434 -4.96538 49.65856 -3.1488E-05
0.8 44.933 -4.965856 -4.717563 -4.729978 -4.49286 44.93293 -3.25617E-05
0.9 40.657 -4.493293 -4.268628 -4.279861 -4.06531 40.657 -3.31459E-05
1 36.788 -4.0657 -3.862415 -3.872579 -3.67844 36.78798 -3.33241E-05
The Runge Kutta Method
120

100

80
No. of Nuclei

RK-4
60
Yexact

40

20

0
0 0.5 1 1.5 2 2.5
time

You might also like