730 likes | 867 Vues
This document reviews numerical methods for solving ordinary differential equations (ODEs), including Euler's method, 2nd order methods like Midpoint and Heun's methods, and Runge-Kutta techniques. It highlights differences between initial value problems (IVPs) and boundary value problems (BVPs), and discusses stability issues particularly in stiff systems. The text also emphasizes the need for appropriate conditions in specifying solutions and provides geometric interpretations of methods, alongside error analysis and stability limits relevant for adaptive stepsizes in computations.
E N D
Ordinary Differential Equations Jyun-Ming Chen
Review Euler’s method 2nd order methods Midpoint Heun’s Runge-Kutta Method Systems of ODE Stability Issue Implicit Methods Adaptive Stepsize Contents
Review • DE (Differential Equation) • An equation specifying the relations among the rate change (derivatives) of variables • ODE (Ordinary DE) vs. PDE (Partial DE) • The number of independent variables involved
Solution of an equation: Solution of DE vs. Solution of Equation f(x) x Review (cont) • Geometrically,
Solution of an differential equation: Geometrically: x t Need additional conditions to specify a solution Review (cont)
Review (cont) • Order of an ODE • The highest derivative in the equation • nth order ODE requires n conditions to specify the solution • IVP (initial value problem): All conditions specified at the same (initial) point • BVP (boundary value problem): otherwise
IVP vs. BVP Physical meaning
Ode2: solves 1st and 2nd order ODE Ic1, ic2, bc: setting conditions ‘ do not evaluate Maxima on ODE
Linear ODE • Linearity: • Involves no product nor nonlinear functions of y and its derivatives • nth order linear ODE
Focus of This Chapter • Solve IVP of nth order ODE numerically • e.g.,
ODE (IVP) • First order ODE (canonical form) • Every nth order ODE can be converted to n first order ODEs in the following method:
The Canonical Problem This is Euler’s method
Example Compare with exact sol:
y 1 y=e–x x Example (cont)
Error Analysis(Geometric Interpretation) Think in terms of Taylor’s expansion If the true solution were a straight line, then Euler is exact
Error Analysis(From Taylor’s Expansion) Euler’s Euler’s truncation error O(Dx2) per step 1st order method
y Cumulative Error x Remark: Dx Error But computation time x = 0 x = T Number of steps = T/Dx Cumulative Err. = (T/Dx) O(Dx2) = O(Dx)
Methods Improving Euler Motivated by Geometric Interpretation
Example (Heun’s) Note the result is the same as Midpoint!?
Comparison of Euler, Heun, midpoint 1st order: Euler 2nd order: Heun, midpoint “order”: All are special cases of RK (Runge-Kutta) methods Remark
RK 4th Order • Mostly commonly used one • Higher order … more evaluation, but less gain on accuracy Classical 4th order RK
System of ODE • Convert higher order ODE to 1st order ODEs • All methods equally apply, in vector form
Initial Condition c m k x Example (Mass-Spring-Damper System) • Governing Equation • After setting the initial conditions x(0) and x’(0), compute the position and velocity of the mass for any t > 0
Assume m=1,c=1, k=1 (for ease of computation) Example (cont) set Dt=0.1
Symptom: Unstable Spring System Become unstable instantly … Start with this … Cause by stiff (k=4000) springs
Example Problem: Stability (cont) Conditionally stable
Discussion • Different algorithm different stability limit • Check Midpoint Method • Different problem different stability limit • use the previous problem as benchmark
Review: Numerical Differentiation Taylor’s expansion: Forward difference Backward difference
Numerical Difference (cont) Central difference
Implicit Method (Backward Euler) Forward difference Backward difference
Example • Remark: • Always stable (for this problem) • Truncation error the same as Euler (only improve the stability)
Stability limit Stiff Set of ODE Use the change of variable Get the following solution: A stiff equation is a differential equation for which certain numerical methods for solving the equation are numerically unstable, unless the step size is taken to be extremely small