450 likes | 979 Views
Today’s class. Ordinary Differential Equations Runge-Kutta Methods. Ordinary Differential Equations. A differential equation is an equation made up of a function and derivatives of that function Example
E N D
Today’s class • Ordinary Differential Equations • Runge-Kutta Methods Prof. Jinbo Bi CSE, UConn
Ordinary Differential Equations • A differential equation is an equation made up of a function and derivatives of that function • Example • An ordinary differential equation (ODE) is a differential equation with only one independent variable Prof. Jinbo Bi CSE, UConn
Ordinary Differential Equations • First-order - highest derivative in the ODE is a first derivative • Second-order - highest derivative in the ODE is a second derivative • Linear - ODE is of the following form Prof. Jinbo Bi CSE, UConn
Initial-Value & Boundary-Value Conditions • IV Conditions • All conditions are given at the same value of the independent variable • BV Conditions • Conditions are given at different value of the independent variables • The numerical methods for solving Initial-value and boundary-value are different. Prof. Jinbo Bi CSE, UConn
Runge-Kutta Methods • Focus on methods to solve first order ODE • Runge-Kutta Methods • Euler’s Method • Huen and Midpoint methods • Classic 4th-order R-K method Prof. Jinbo Bi CSE, UConn
Euler’s Method Prof. Jinbo Bi CSE, UConn
Euler’s Method Prof. Jinbo Bi CSE, UConn
Euler’s Method • Example: • True: • h = 0.5 Prof. Jinbo Bi CSE, UConn
Euler’s Method Prof. Jinbo Bi CSE, UConn
Error Analysis • Global truncation errors • Local truncation - from application of Euler’s method over a single step • Propagation truncation - from approximation produced during previous steps Prof. Jinbo Bi CSE, UConn
Error Analysis • Start with Taylor Series expansion • Local truncation error Prof. Jinbo Bi CSE, UConn
Error Analysis • Global Truncation Error Prof. Jinbo Bi CSE, UConn
Euler’s Method • Not very accurate • Reducing the step size can improve accuracy but will also increase computation • Can be useful for quick analysis (assuming large step size) Prof. Jinbo Bi CSE, UConn
Euler’s Method Improvements • Higher order Taylor Series • Heun’s Method • Midpoint/Improved Polygon Method Prof. Jinbo Bi CSE, UConn
Higher order Taylor Series • If f is a function of both the dependent and independent variables, you need to calculate the partial derivatives Prof. Jinbo Bi CSE, UConn
Heun’s Method • Main drawback of Euler’s method is that it assumes that the derivative at the beginning of the interval is the same across the interval • A better estimate involves looking at the derivatives at both ends of the interval and then averaging • Heun method uses the average of the derivatives at the points (xi, yi) and (xi+1, yi+1) to compute yi+1. Since, the derivative at (xi+1, yi+1) is unknown, first to estimate yi+1, then using the average derivative to compute yi+1. Prof. Jinbo Bi CSE, UConn
Heun’s Method • Local truncation error is O(h3) and global truncation error is O(h2) Prof. Jinbo Bi CSE, UConn
Heun’s Method Prof. Jinbo Bi CSE, UConn
Heun’s Method • Can further use yi+1to re-estimate the derivative at (xi+1, yi+1) and then obtain a better result. The iteration can go on until an accurate result is achieved • Further iterations may not converge on the true answer but it will converge on a finite truncation error Prof. Jinbo Bi CSE, UConn
Heun’s Method Prof. Jinbo Bi CSE, UConn
Midpoint Method Prof. Jinbo Bi CSE, UConn
Midpoint Method Prof. Jinbo Bi CSE, UConn
Midpoint Method Prof. Jinbo Bi CSE, UConn
Runge-Kutta Methods Prof. Jinbo Bi CSE, UConn
The principles of Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
The principles of Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
The principles of Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
The principles of Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
Heun method Midpoint method The principles of Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
Third-order Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
Classic 4th-order Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
Classic 4th-order Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
Classic 4th-order Runge-Kutta Method Prof. Jinbo Bi CSE, UConn
Comparison of Runge-Kutta Methods Prof. Jinbo Bi CSE, UConn
Systems of ODEs Prof. Jinbo Bi CSE, UConn
Higher-order ODE Prof. Jinbo Bi CSE, UConn
Systems of ODEs • Can use same higher-order Runge Kutta methods with systems of ODEs • Must be careful in determining slopes • First find slopes at the initial value (k1) • Then slopes at the midpoints (k2) • Then refine slopes at the midpoint (k3) • Then find slopes at the endpoint (k4) Prof. Jinbo Bi CSE, UConn
Systems of ODEs Prof. Jinbo Bi CSE, UConn
Systems of ODEs Prof. Jinbo Bi CSE, UConn
Next class • Ordinary Differential Equations • Read Chapter 25, 26 Prof. Jinbo Bi CSE, UConn