12 Ordinary Differential Equations: Initial-Value Problems

Slides:



Advertisements
Similar presentations
SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM Read , 26-2, 27-1 CISE301_Topic8L8&9 KFUPM.
Advertisements

Ordinary Differential Equations
1cs542g-term Notes  Notes for last part of Oct 11 and all of Oct 12 lecture online now  Another extra class this Friday 1-2pm.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Ordinary Differential Equations Equations which are.
Chapter 1 Introduction The solutions of engineering problems can be obtained using analytical methods or numerical methods. Analytical differentiation.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 31 Ordinary Differential Equations.
Initial-Value Problems
Dr. Jie Zou PHY Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (II) 1 1 Besides the main textbook, also see Ref.: “Applied.
8-1 Chapter 8 Differential Equations An equation that defines a relationship between an unknown function and one or more of its derivatives is referred.
王俊鑫 (Chun-Hsin Wang) 中華大學 資訊工程系 Fall 2002 Chap 2 Numerical Methods for First-Order Differential Equations.
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW III.
Multistep methods previous methods use information at xi to predict yi+1 multistep methods use information from xi-1, xi-2, etc. leads to better results.
Chapter 17 Objectives Recognizing that Newton-Cotes integration formulas are based on the strategy of replacing a complicated function or tabulated data.
Numerical Solutions of Ordinary Differential Equations
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
Chapter 16 Integration of Ordinary Differential Equations.
CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2,
Differential Equations and Boundary Value Problems
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Solution of Ordinary Differential Equation
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 10. Ordinary differential equations. Initial value problems.
Fin500J Topic 7Fall 2010 Olin Business School 1 Fin500J Mathematical Foundations in Finance Topic 7: Numerical Methods for Solving Ordinary Differential.
1 Chapter 6 Numerical Methods for Ordinary Differential Equations.
PART 7 Ordinary Differential Equations ODEs
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Boyce/DiPrima 9th ed, Ch 8.4: Multistep Methods Elementary Differential Equations and Boundary Value Problems, 9th edition, by William E. Boyce and Richard.
Erin Catto Blizzard Entertainment Numerical Integration.
EE3561_Unit 8Al-Dhaifallah14351 EE 3561 : Computational Methods Unit 8 Solution of Ordinary Differential Equations Lesson 3: Midpoint and Heun’s Predictor.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Dept. of Computer Science & Engineering, Korea Univ. Systems of ODEs (Ordinary Differential Equations) June 8, 2005 Sung-Min Kim, Ho-Kuen Shin, A-Yon Park.
Modelling & Simulation of Chemical Engineering Systems Department of Chemical Engineering King Saud University 501 هعم : تمثيل الأنظمة الهندسية على الحاسب.
Integration of 3-body encounter. Figure taken from
Numerical Solutions of ODE
Engineering Analysis – Computational Fluid Dynamics –
Scientific Computing Multi-Step and Predictor-Corrector Methods.
Ordinary Differential Equations (ODEs) 1Michael Sokolov / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Michael Sokolov ETH Zurich, Institut.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 7 - Chapter 25.
Numerical Analysis – Differential Equation
Chapter 10 ordinary differential equations (ODEs) Chapter 11 systems of ODEs (6 th edition)
Please remember: When you me, do it to Please type “numerical-15” at the beginning of the subject line Do not reply to my gmail,
Chapter 5. Ordinary Differential Equation
Dr. Mujahed AlDhaifallah ( Term 342)
Today’s class Ordinary Differential Equations Runge-Kutta Methods
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Sec 21: Generalizations of the Euler Method Consider a differential equation n = 10 estimate x = 0.5 n = 10 estimate x =50 Initial Value Problem Euler.
ACSL, POSTECH1 MATLAB 입문 CHAPTER 8 Numerical Calculus and Differential Equations.
1/14  5.2 Euler’s Method Compute the approximations of y(t) at a set of ( usually equally-spaced ) mesh points a = t 0 < t 1
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Sec 232: The coefficient tableau 2ed order RK method Expand all f around (x,y) using Taylor expansion in 2d and then choose constants such that the equation.
This chapter is concerned with the problem in the form Chapter 6 focuses on how to find the numerical solutions of the given initial-value problems. Main.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
Runge Kutta schemes Taylor series method Numeric solutions of ordinary differential equations.
CISE301_Topic8L71 CISE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2,
Keywords (ordinary/partial) differencial equation ( 常 / 偏 ) 微分方程 difference equation 差分方程 initial-value problem 初值问题 convex 凸的 concave 凹的 perturbed problem.
Ordinary Differential Equations
Engineering Problem Solution
Part 7 - Chapter 25.
Numerical Methods by Dr. Laila Fouad.
Ordinary Differential Equations
Class Notes 18: Numerical Methods (1/2)
Numerical Solutions of Ordinary Differential Equations
SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2, 27-1 CISE301_Topic8L4&5.
Class Notes 19: Numerical Methods (2/2)
Chapter 26.
Sec:5.4 RUNGE-KUTTA METHODS.
Numerical Analysis Lecture 37.
SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2, 27-1 CISE301_Topic8L2.
Numerical Analysis Lecture 36.
CISE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM Read , 26-2, 27-1 CISE301_Topic8L7 KFUPM.
Presentation transcript:

12 Ordinary Differential Equations: Initial-Value Problems 2005. 06. 01 자연어처리 연구실 김혜겸 윤도상 최성원

Introduction Techniques for solving first-order ordinary differential equations are the subject of this chapter the differential equation is written in the form with the value of function given at ,i.e., . Basic idea is to divide the internal of interest into discrete steps and find approximations to the function y at those values of . Taylor Method Runge-Kutta Method Multistep Method

12.1 TAYLOR METHODS Consider two methods that are based on the Taylor series representation of unknown function . Euler’s method Uses only the first term in the Taylor series Higher order Taylor method

12.1 TAYLOR METHODS 12.1.1 Euler’s Method The simplest method of approximating the solution of the differential equation Start by treating the function as a constant, , and replace the derivative by the forward difference quotient. This gives or ( where ) Geometrically, this corresponds to using the line tangent to the true solution curve to find the value of .

12.1 TAYLOR METHODS 12.1.1 Euler’s Method Euler Method gives , for For example,

Example 12.1 Solving a Simple ODE with Euler’s Method(1/2) , (i.e., a=0, b=1) , . First, find the approximate solution for h =0.5 (n =2) Approximation at is Second, find the approximate solution at :

Example 12.1 Solving a Simple ODE with Euler’s Method(2/2) To find a better approximate solution(use n=10 intervals)

MATLAB Function For Euler’s Method

Example 12.2 Another Example of the Use of Euler’s Method Consider the differential equation Interval with initial value With intervals, the step size Exact solution is y1=y0+hf(x0,y0) =0+0.2(1)=0.2 y2=y1+hf(x1,y1) =0.2+0.2(0.2(-0.4+1/2))=0.384 .

Discussion How well a numerical technique for solving an initial-value ordinary differential equation works Total truncation error for Euler’s method is Related to the truncation error of the method is Result of basic Euler’s method can be improved by using it with Richardson extrapolation Step size Extrapolation level Computed directly from Euler’s method

12.1 TAYLOR METHODS 12.1.2 Higher Order Taylor Method Use more terms in the Taylor series for y, in order to obtain a higher order truncation error However do not have a formula for If is not too complicated Differentiate with respect to to find a representation for

Example 12.3 Solving a Simple ODE with Taylor’s Method Consider the differential equation with initial condition To apply the second order Taylor method This gives the approximation formula or For , we find

MATLAB Function For Taylor’s Method

12.2 RUNGE-KUTTA METHOD 배경 Talyor 해법은 Euler해법에 비해서 정확하지만, f(x,y)의 고계도함수를 구해야 하는 어려움 Runge-kutta해법은 talyor 해법의 장점이 되는 계산 정밀도는 유지하되, 단점을 보완한 방법

12.2 RUNGE-KUTTA METHOD 12.2.1 Midpoint Method 공식 Runge-kutta 해법은 더 쉬운 계산법을 사용하여 Tailer방법을 근사시키는 전략을 사용함

12.2 RUNGE-KUTTA METHOD 12.2.1 Midpoint Method Example 12.4 Solving a Simple ODE with the Midpoint Method 에서 미분 방정식은 , y(0) = 2 1) h = 0.5 (n=2)  x1 = 0.5 <P406 참조> Exact : 3.4462 Euler’s : 3.3315 2) x2 = 0.0 + 2h = 1.0 <P406 참조> Exact : 6.1548 Euler’s : 5.7812

12.2 RUNGE-KUTTA METHOD 12.2.1 Midpoint Method MATLAB Function for the Midpoint Method Function [x, y] = RK2 (f, tspan, y0, n) % function [x, y] = RK2 (f, y0, a, b, n) % solve y’ = f(x, y) % with initial condition y(a) = y0 % using n steps of the midpoint (RK2) method; a = trans(1); b = trans(2); h = (b - a) / n x = (a+h: h : b); k1 = h * feval (f, a, y0); k2 = h * feval (f, a + h / 2, y0 + k1 / 2); y(1) = y0 + k2; for i = 1 : n-1 k1 = h * feval (f, x(i), y(i) ); k2 = h * feval (f, x(i) + h / 2, y(i) + k1 / 2); y(i+1) = y(i) + k2; end x = [ a x ]; y = [ y0 y];

12.2 RUNGE-KUTTA METHOD 12.2.2 Other Second-Order Runge-Kutta Mehods Modified Euler’s method Heun’s method Midpoint Method c2 a21 w1 w2 1 1/2 2/3 1/4 3/4 1/2 1

12.2 RUNGE-KUTTA METHOD 12.2.3 Third-Order Runge-Kutta Mehods c3 a31 w1 w2 c2 a21 a32 w3 - Nystrom - Nearly Optimal 2/3 2/8 3/8 3/4 2/9 3/9 1/2 4/9 - Classical - Heun 1 -1 1/6 4/6 1/2 2 2/3 1/4 1/3 3/4

12.2 RUNGE-KUTTA METHOD 12.2.4 Classic Runge-Kutta Method 2차나 3차보다 더 정확한 해를 구해 줌 다른 Runge-Kutta방법들 중에서 가장 널리 사용됨

12.2 RUNGE-KUTTA METHOD 12.2.4 Classic Runge-Kutta Method MATLAB Function for Classic Runge-Kutta Method Function [x, y] = RK4 (f, tspan, y0, n) % solve y’ = f(x, y) with initial condition y(a) = 0 % using n steps of the classic 4th order Runge-Kutta method; a = trans(1); b = trans(2); h = (b - a) / n x = (a+h: h : b); k1 = h * feval (f, a, y0); k2 = h * feval (f, a + h / 2, y0 + k1 / 2); k3 = h * feval (f, a + h / 2, y0 + k2 / 2); k4 = h * feval (f, a + h, y0 + k3); y(1) = y0 + k1/6 + k2/3 + k3/3 + k4/6; for i = 1 : n-1 k1 = h * feval (f, x(i), y(i) ); k2 = h * feval (f, x(i) + h/2, y(i) + k1 / 2); k3 = h * feval (f, x(i) + h/2, y(i) + k2 / 2); k4 = h * feval (f, x(i) + h, y(i) + k3); y(i+1) = y(i) + k1/6 + k2/3 + k3/3 + k4/6; end x = [ a x ]; y = [ y0 y];

12.2 RUNGE-KUTTA METHOD 12.2.4 Classic Runge-Kutta Method Example 12.6 Solving a Simple ODE with the Classic Runge-Kutta Method x Exact solution Approximate Solution Absolute error 0.2 2.4642 8.2745e-06 0.4 3.0755 2.0213e-05 0.6 3.8664 3.8663 3.7032e-05 0.8 4.8766 6.0308e-05 1.0 6.1548 9.2076e-05 <P406 참조> Exact : 6.1548 Euler’s : 5.7812 Midpoint : 5.922

12.2 RUNGE-KUTTA METHOD 12.2.5 Other Runge-Kutta Methods General Runge-Kutta Mothod (1/2) c3 a31 w1 w2 c2 a21 a32 w3 c4 a41 a42 a43 w4

12.2 RUNGE-KUTTA METHOD 12.2.5 Other Runge-Kutta Methods General Runge-Kutta Mothod (2/2) - Classic fourth-order Runge-Kutta - Kutta’s method 1/2 1/6 2/6 1 1/2 1/6 2/6 1 - Lawson’s fifth-order Runge-Kutta Method - Butcher’s sixth-order Runge-Kutta method 2/3 11/120 1/3 27/40 1/12 -1/12 1/2 -1/16 9/8 -3/16 -3/8 -3/4 -4/15 1 9/44 -9/11 63/44 18/11 -16/11 1/4 3/16 7/90 1/2 1/16 32/90 12/90 3/4 -3/16 6/16 1 1/7 4/7 6/7 9/16 -12/7 8/7

12.3 Multistep methods Multistep methods 앞에서의 방법론들은 단일점 x = xi 에서의 정보를 이용하여, x = xi+1의 해 yi+1의 값을 계산했다. – one step methods 단계별로 계산량이 적기 때문에 다른 방법에 비해 효율적 General form of two-step methods a1,a2,b0,b1 등은 methods에 따라 달라진다. 앞으로는 다음과 같은 notation으로 표현하겠다.

12.3 Multistep methods Multi-step methods (cont’) Multi-step methods는 fi+1의 계수 b의 값에 따라 b = 0인 경우 명시적(explicit) 또는 개식(open) methods라 부르고, b ≠0 인 경우에는 암묵적(implicit) 또는 폐식(closed) method라 부른다. Multi-step methods는 시작 값을 필요로 하므로, 보통 Runge-Kutta와 같은 기존의 method를 이용해서 초기값 y1,y2,…을 구한다.

12.3 Multistep methods 12.3.1 Adams-Bashforth Methods Most popular explicit multistep methods Two-step method formula Local truncation error O(h3) Three-step method formula y0 는 주어져 있고, y1&y2 는 one-step method에서 얻는다. Local truncation error O(h4) Step이 올라가면 그만큼 truncation error가 줄어든다.

12.3 Multistep methods 12.3.1 Adams-Bashforth Methods Mathlab code

12.3 Multistep methods 12.3.1 Adams-Bashforth Methods Example 12.8 Y’ = x+y, y(0) = 2 x 0.2 0.4 0.6 0.8 1 y 2 2.46 3.0652 3.8509 4.8546 6.1241 (real)y 2.4642 3.0755 3.8664 4.8766 6.1548

12.3 Multistep methods 12.3.2 Adams-Moultion Methods Most popular implicit method Two-step method formula y0 is given, y1 is found from a one step methods Local truncation error : O(h4) Adams-Bashforth Methods의 local truncation error : O(h3) Adams-Bashforth Methods에 비해서 error가 작다

12.3 Multistep methods 12.3.2 Adams-Moultion Methods Matlab code

12.3 Multistep methods 12.3.2 Predictor-Corrector Methods Procedure 각 구간에서 predictor step으로 implicit method를 사용한다 Corrector step으로 explicit method를 사용한다. (predictor가 새 점에서 문제를 예측하고 corrector가 그 정확도를 개선하는 것을 의미한다.) Adams Third-Order Predictor-Corrector Method y0는 초기값으로 주어지고, y1, y2는 one-step method로 구한다. Predictor Corrector

12.4 Stability Definition Root condition : M-step method 에 대한 characteristic polynomial 의 근을 λ1, λ2,… λm 로 나타낼때, | λi| ≤ 1, i = 1,2,…,m 이고, 절대값이 1인 모든 근이 simple root이면, root condition을 만족한다 라고 한다. Strongly stable : root condition을 만족하고 크기가 1인 특성방정식의 유일한 근으로 λ = 1 인 방법 Weakly stable : root condition 을 만족하고 크기가 1인 근을 두개 이상 갖는 방법 Unstable : root condition 을 만족하지 않는 방법

12.4 Stability Example 12.11 – Weakly Stable method Simple two step method yi+1 = yi-1 +2hfi Differential equation y’ = -4y, y(0) = 1 : exact solution is y = e-4x P(λ) = λ2 – (a1λ1 + a2λ0 ) = λ2 – 1 = 0 : λ = 1, -1 ㅡ> weakly stable

12.4 Stability Example 12.11(cont’)

12.5 MATLAB ’s Method MATLAB includes three functions for solving non-stiff ODEs ode 23, ode45 Implement a pair of explicit Runge-Kutta methods second and third order and forth and fifth order ode113 Fully variable step-size ODE solver based on the Adams-Bashforth-Moulton family of formulas of orders 1-12 syntax for function [t, y] = ode23(‘F’, tspan, y0), where tspan=[t0 t_final] ‘F’: string contatining the name of an ODE file F(t, y): must return a column vector of values each row of solution array y corresponds to a time returned in column vector t y0: initial conditions are given in the vector y0

Appendix A

12.2 RUNGE-KUTTA METHOD Runge-Kutta방법의 유도 이라 할 때, (1) 여기서 실수 a, b, α, β 는 (1)를 Taylor 급수 전개하였을 때, 가능한 한 Taylor 방법과 같아 지도록 결정되어져야 할 상수이다. 이제, y(xn+1)을 투 근방에서 Taylor 급수 전개하면, (2) 이다.

12.2 RUNGE-KUTTA METHOD 한편, 2변수 함수의 Taylor전개를 이용하면, 이므로, k2를 (1)에 대입하면 을 얻는다. 이제, (1)식과 (2)식을 비교하여 h항과 h2항을 같도록 하려면 (3)

Truncation error 수치해 ui에 포함된 오차 ei 전체 절단오차 단계의 수가 (i+1)이라면, Xi+1에서 전체 절단오차는 각 단계 발생오차와 계산 단계 수를 곱한 것이라 할 수 있다. 로 부터 를 얻을 수 있으므로 각 단계 발생오차와 계산 단계 수를 곱하면 전체 절단 오차는 이다. →first order method