• date post

23-Dec-2015
• Category

## Documents

• view

227

5

Embed Size (px)

### Transcript of CSE 330 : Numerical Methods Lecture 17: Solution of Ordinary Differential Equations (a)...

• Slide 1
• CSE 330 : Numerical Methods Lecture 17: Solution of Ordinary Differential Equations (a) Eulers Method (b) Runge-Kutta Method Dr. S. M. Lutful Kabir Visiting Research Professor, BRAC University & Professor (on leave) IICT, BUET 1 Prof. S. M. Lutful Kabir, BRAC University
• Slide 2
• Eulers Method Step size, h x y x 0,y 0 True value y 1, Predicted value Slope Figure 1 Graphical interpretation of the first step of Eulers method Prof. S. M. Lutful Kabir, BRAC University2
• Slide 3
• Eulers Method Step size h True Value y i+1, Predicted value yiyi x y xixi x i+1 Figure 2. General graphical interpretation of Eulers method Prof. S. M. Lutful Kabir, BRAC University3
• Slide 4
• How to write Ordinary Differential Equation Example is rewritten as In this case How does one write a first order differential equation in the form of Prof. S. M. Lutful Kabir, BRAC University 4
• Slide 5
• Example A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K. Assuming heat is lost only due to radiation, the differential equation for the temperature of the ball is given by Find the temperature at seconds using Eulers method. Assume a step size of seconds. Prof. S. M. Lutful Kabir, BRAC University5
• Slide 6
• Solution Step 1: is the approximate temperature at Prof. S. M. Lutful Kabir, BRAC University6
• Slide 7
• Solution Cont For Step 2: is the approximate temperature at Prof. S. M. Lutful Kabir, BRAC University7
• Slide 8
• Solution Cont The exact solution of the ordinary differential equation is given by the solution of a non-linear equation as The solution to this nonlinear equation at t=480 seconds is Prof. S. M. Lutful Kabir, BRAC University8
• Slide 9
• Comparison of Exact and Numerical Solutions Figure 3. Comparing exact and Eulers method Prof. S. M. Lutful Kabir, BRAC University9
• Slide 10
• Step, h (480) EtEt | t |% 480 240 120 60 30 987.81 110.32 546.77 614.97 632.77 1635.4 537.26 100.80 32.607 14.806 252.54 82.964 15.566 5.0352 2.2864 Effect of step size Table 1. Temperature at 480 seconds as a function of step size, h (exact) Prof. S. M. Lutful Kabir, BRAC University10
• Slide 11
• Comparison with exact results Figure 4. Comparison of Eulers method with exact solution for different step sizes Prof. S. M. Lutful Kabir, BRAC University11
• Slide 12
• Effects of step size on Eulers Method Figure 5. Effect of step size in Eulers method. Prof. S. M. Lutful Kabir, BRAC University12
• Slide 13
• Errors in Eulers Method It can be seen that Eulers method has large errors. This can be illustrated using Taylor series. As you can see the first two terms of the Taylor series The true error in the approximation is given by are the Eulers method. Prof. S. M. Lutful Kabir, BRAC University13
• Slide 14
• Runge Kutta 2 nd Order Method Runge Kutta thought to consider upto second derivative terms in Taylors series In that case the Eulars Method will be extended to But finding the second derivative is sometimes difficult Hence they used the average of two approximate slopes as follows: where, 14Prof. S. M. Lutful Kabir, BRAC University
• Slide 15
• Runge Kutta Method (Heuns Method) x y xixi x i+1 y i+1, predicted y i Figure 1 Runge-Kutta 2nd order method (Heuns method) Prof. S. M. Lutful Kabir, BRAC University15
• Slide 16
• Example A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K. Assuming heat is lost only due to radiation, the differential equation for the temperature of the ball is given by Find the temperature at seconds using Heuns method. Assume a step size of seconds. Prof. S. M. Lutful Kabir, BRAC University16
• Slide 17
• Solution Step 1: Prof. S. M. Lutful Kabir, BRAC University17
• Slide 18
• Solution Cont Step 2: Prof. S. M. Lutful Kabir, BRAC University18
• Slide 19
• Comparison with exact results Figure 2. Heuns method results for different step sizes Prof. S. M. Lutful Kabir, BRAC University19
• Slide 20
• Effect of step size Table 1. Temperature at 480 seconds as a function of step size, h Step size, h (480) EtEt | t |% 480 240 120 60 30 393.87 584.27 651.35 649.91 648.21 1041.4 63.304 3.7762 2.3406 0.63219 160.82 9.7756 0.58313 0.36145 0.097625 (exact) Prof. S. M. Lutful Kabir, BRAC University20
• Slide 21
• 21 Runge-Kutta 4 th Order Method where For Runge Kutta 4 th order method is given by Prof. S. M. Lutful Kabir, BRAC University
• Slide 22
• 22 Example A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K. Assuming heat is lost only due to radiation, the differential equation for the temperature of the ball is given by Find the temperature at seconds using Runge-Kutta 4 th order method. seconds. Assume a step size of Prof. S. M. Lutful Kabir, BRAC University
• Slide 23
• 23 Solution Step 1: Prof. S. M. Lutful Kabir, BRAC University
• Slide 24
• 24 Solution Cont is the approximate temperature at Prof. S. M. Lutful Kabir, BRAC University
• Slide 25
• 25 Comparison with exact results Figure 1. Comparison of Runge-Kutta 4th order method with exact solution Prof. S. M. Lutful Kabir, BRAC University
• Slide 26
• Step size, h (480) EtEt | t |% 480 240 120 60 30 90.278 594.91 646.16 647.54 647.57 737.85 52.660 1.4122 0.033626 0.00086900 113.94 8.1319 0.21807 0.0051926 0.00013419 26 Effect of step size Table 1. Temperature at 480 seconds as a function of step size, h (exact) Prof. S. M. Lutful Kabir, BRAC University
• Slide 27
• THANKS Prof. S. M. Lutful Kabir, BRAC University27