Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sec:5.4 RUNGE-KUTTA METHODS.

Similar presentations


Presentation on theme: "Sec:5.4 RUNGE-KUTTA METHODS."β€” Presentation transcript:

1 Sec:5.4 RUNGE-KUTTA METHODS

2 Sec:5.4 RUNGE-KUTTA METHODS
1) Euler Method 2) Modified Euler Method 3) Midpoint Method 4) Heun's Method 5) RK4 Method Computational Examples MATLAB Derivations

3 Sec:5.4 RUNGE-KUTTA METHODS
Initial Value Problem Euler’s Method 𝑦 β€² =𝑓 𝑑,𝑦 𝑦(π‘Ž) =𝛼 𝑀 𝑖+1 = 𝑀 𝑖 +β„Žπ‘“ 𝑑 𝑖 , 𝑀 𝑖 𝑀 =𝛼 π‘Žβ‰€ 𝑑 ≀𝑏, Modified Euler Method Euler’s Method 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 2 𝑲 𝟏 + 𝑲 𝟐 𝑀 =𝛼 𝑀 𝑖+1 = 𝑀 𝑖 +β„Ž 𝑲 𝟏 𝑀 =𝛼 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 +β„Ž, 𝑀 𝑖 + 𝑲 𝟏 β„Ž Modified Euler Method 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 2 𝒇 𝒕 π’Š , π’˜ π’Š +𝑓 𝑑 𝑖 +β„Ž, 𝑀 𝑖 +β„Žπ’‡ 𝒕 π’Š , π’˜ π’Š 𝑀 =𝛼

4 Sec:5.4 RUNGE-KUTTA METHODS
Modified Euler Method Example 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 2 𝑲 𝟏 + 𝑲 𝟐 𝑀 =𝛼 Use the Modified Euler method h = 0.5, to approximate 𝑦(1) 𝑦 β€² =π‘¦βˆ’ 𝑑 2 +1 0≀ 𝑑 ≀4, 𝑦(0) = 0.5 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 +β„Ž, 𝑀 𝑖 + 𝑲 𝟏 β„Ž 𝑓(𝑑,𝑦)=π‘¦βˆ’ 𝑑 2 +1 𝑲 𝟏 =𝑓 𝑑 1 , 𝑀 1 𝑲 𝟏 =𝑓 𝑑 0 , 𝑀 0 =𝑓 0.5,1.375 =2.125 𝑲 𝟐 =𝑓 𝑑 1 +β„Ž, 𝑀 1 + 𝑲 𝟏 β„Ž =𝑓 0,0.5 =1.5 =𝑓 1,1.375+𝟐.πŸπŸπŸ“βˆ—0.5 𝑲 𝟐 =𝑓 𝑑 0 +β„Ž, 𝑀 0 + 𝑲 𝟏 β„Ž =2.4375 =𝑓 0.5,0.5+𝟏.πŸ“βˆ—0.5 =2 π’˜ 𝟐 =𝟏.πŸ‘πŸ•πŸ“+ 𝟏 𝟐 βˆ—πŸ.πŸπŸπŸ“ + 𝟏 𝟐 βˆ—πŸ.πŸ’πŸ‘πŸ•πŸ“ 𝟎.πŸ“ 𝑀 1 = βˆ—πŸ.πŸ“+ 1 2 βˆ—πŸ 0.5 𝑀 2 = 𝑀 1 =1.375 β†’π’š(𝟏)β‰ˆπŸ.πŸ“πŸπŸ“πŸ”πŸπŸ“ β†’π’š(𝟎.πŸ“)β‰ˆπŸ.πŸ‘πŸ•πŸ“

5 Sec:5.4 RUNGE-KUTTA METHODS
1) Euler Method 2) Modified Euler Method 3) Midpoint Method 4) Heun's Method 5) RK4 Method

6 Sec:5.4 RUNGE-KUTTA METHODS
Example Midpoint method Use the Midpoint method h = 0.5, to approximate 𝑦(0.5) 𝑀 𝑖+1 = 𝑀 𝑖 + β„Žπ‘² 𝟐 𝑀 =𝛼 𝑦 β€² =π‘¦βˆ’ 𝑑 2 +1 0≀ 𝑑 ≀4, 𝑦(0) = 0.5 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 + β„Ž 2 , 𝑀 𝑖 + β„Ž 2 𝑲 𝟏 Midpoint method 𝑀 𝑖+1 = 𝑀 𝑖 +𝒉𝑓 𝑑 𝑖 + β„Ž 2 , 𝑀 𝑖 + β„Ž 2 𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑀 =𝛼 𝑲 𝟐 =𝑓 𝑑 βˆ—β„Ž, 𝑀 βˆ—π‘² 𝟏 β„Ž 𝑓(𝑑,𝑦)=π‘¦βˆ’ 𝑑 2 +1 𝑲 𝟏 =𝑓 𝑑 0 , 𝑀 0 =𝑓 0.5, βˆ—πŸ.πŸ“βˆ—0.5 =1.8125 =𝑓 0,0.5 =1.5 𝑀 1 =0.5+ 𝟏.πŸ–πŸπŸπŸ“ 0.5 = β†’π’š(𝟎.πŸ“)β‰ˆπŸ.πŸ’πŸŽπŸ”πŸπŸ“

7 Sec:5.4 RUNGE-KUTTA METHODS
1) Euler Method 2) Modified Euler Method 3) Midpoint Method 4) Heun's Method 5) RK4 Method

8 Sec:5.4 RUNGE-KUTTA METHODS
Heun's Method Example 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 4 𝑲 𝟏 +3 𝑲 πŸ‘ 𝑀 =𝛼 Use the Heun's method with h = 0.2, to approximate 𝑦(0.2) 𝑦 β€² =π‘¦βˆ’ 𝑑 2 +1 0≀ 𝑑 ≀2, 𝑦(0) = 0.5 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 + β„Ž 3 , 𝑀 𝑖 + β„Ž 3 𝑲 𝟏 𝑲 πŸ‘ =𝑓 𝑑 𝑖 + 2β„Ž 3 , 𝑀 𝑖 + 2β„Ž 3 𝑲 𝟐 𝑓(𝑑,𝑦)=π‘¦βˆ’ 𝑑 2 +1 𝑲 πŸ‘ =𝑓 𝑑 0 +2/15, 𝑀 0 +(2/15)(1.5956) 𝑲 𝟏 =𝑓 𝑑 0 , 𝑀 0 = =𝑓 0,0.5 =1.5 𝑀 1 = 𝟏.πŸ“+3βˆ—πŸ 𝑲 𝟐 =𝑓 𝑑 0 +1/15, 𝑀 /15 =1.5956 𝑀 1 = β†’π’š(𝟎.𝟐)β‰ˆπŸŽ.πŸ–πŸπŸ—πŸπŸ’

9 Sec:5.4 RUNGE-KUTTA METHODS
𝑢(𝒉) 1) Euler Method 𝑢( 𝒉 𝟐 ) 2) Modified Euler Method 𝑢( 𝒉 𝟐 ) 3) Midpoint Method 𝑢( 𝒉 πŸ‘ ) 4) Heun's Method 𝑢( 𝒉 πŸ’ ) 5) RK4 Method

10 Sec:5.4 RUNGE-KUTTA METHODS
Modified Euler Method Euler’s Method 𝑀 𝑖+1 = 𝑀 𝑖 +β„Ž 𝑲 𝟏 𝑀 =𝛼 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 2 𝑲 𝟏 + 𝑲 𝟐 𝑀 =𝛼 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 Heun's Method 𝑲 𝟐 =𝑓 𝑑 𝑖 +β„Ž, 𝑀 𝑖 + 𝑲 𝟏 β„Ž 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 4 𝑲 𝟏 +3 𝑲 πŸ‘ 𝑀 =𝛼 Midpoint method 𝑀 𝑖+1 = 𝑀 𝑖 + β„Žπ‘² 𝟐 𝑀 =𝛼 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 + β„Ž 3 , 𝑀 𝑖 + β„Ž 3 𝑲 𝟏 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 + β„Ž 2 , 𝑀 𝑖 + β„Ž 2 𝑲 𝟏 𝑲 πŸ‘ =𝑓 𝑑 𝑖 + 2β„Ž 3 , 𝑀 𝑖 + 2β„Ž 3 𝑲 𝟐

11 Sec:25.3 RUNGE-KUTTA METHODS
clear; clc; y-t.^2+1; h=0.2; alpha = 0.5; tspan = 0:h:4 [w] = midpoint(f,tspan,alpha); [tspan;w]' plot(tspan,w, '-ro'); grid on function [w] = midpoint(f,tspan,alpha) w(1)=alpha; t(1)=tspan(1); n1=length(tspan)-1; h=tspan(2)-tspan(1); for i=1:n1 K1 = f(t(i),w(i)); K2 = f(t(i)+0.5*h,w(i)+0.5*h*K1) w(i+1)=w(i)+(K2)*h t(i+1)=t(i)+h; end; end

12 Sec:5.4 RUNGE-KUTTA METHODS
1) Euler Method 2) Modified Euler Method 3) Midpoint Method 4) Heun's Method 5) RK4 Method Computational Examples MATLAB Derivations

13 Fourth-Order Runge-Kutta Methods
Sec:25.3 RUNGE-KUTTA METHODS π‘«π’†π’“π’Šπ’—π’‚π’•π’Šπ’π’ The most popular method is the fourth order Runge-Kutta method, or RK4 method Fourth-Order Runge-Kutta Methods π‘Š 𝑖+1 = π‘Š 𝑖 + 𝟏 πŸ” 𝑲 𝟏 + πŸπ‘² 𝟐 + πŸπ‘² πŸ‘ + 𝑲 πŸ’ π‘Š =𝛼 𝑲 𝟏 =β„Ž 𝐹 𝑑 𝑖 , π‘Š 𝑖 𝑲 𝟐 =β„Ž 𝐹 𝑑 𝑖 + β„Ž 2 , π‘Š 𝑖 𝑲 𝟏 𝑲 πŸ‘ =β„Ž 𝐹 𝑑 𝑖 + β„Ž 2 , π‘Š 𝑖 𝑲 𝟐 𝑲 πŸ’ =β„Ž 𝐹 𝑑 𝑖+1 , π‘Š 𝑖 + 𝑲 πŸ‘

14 Fourth-Order Runge-Kutta Methods
Sec:5.4 RUNGE-KUTTA METHODS Fourth-Order Runge-Kutta Methods Example Use the RK4 method with h = 0.2, to approximate 𝑦(0.2) π‘Š 𝑖+1 = π‘Š 𝑖 + 𝟏 πŸ” 𝑲 𝟏 + πŸπ‘² 𝟐 + πŸπ‘² πŸ‘ + 𝑲 πŸ’ π‘Š =𝛼 𝑲 𝟏 =β„Ž 𝐹 𝑑 𝑖 , π‘Š 𝑖 𝑦 β€² =π‘¦βˆ’ 𝑑 2 +1 0≀ 𝑑 ≀2, 𝑦(0) = 0.5 𝑲 𝟐 =β„Ž 𝐹 𝑑 𝑖 + β„Ž 2 , π‘Š 𝑖 𝑲 𝟏 𝑲 πŸ‘ =β„Ž 𝐹 𝑑 𝑖 + β„Ž 2 , π‘Š 𝑖 𝑲 𝟐 𝑲 πŸ’ =β„Ž 𝐹 𝑑 𝑖+1 , π‘Š 𝑖 + 𝑲 πŸ‘

15 Sec:5.4 RUNGE-KUTTA METHODS

16 Implicit Euler’s Method Explicit Euler’s Method
Sec:5.4 RUNGE-KUTTA METHODS Explicit and Implicit Euler Implicit Euler’s Method called implicit because the unknown appears on both sides of the equation. 𝑀 𝑖+1 = 𝑀 𝑖 +β„Žπ‘“ 𝑑 π’Š+𝟏 , 𝑀 π’Š+𝟏 𝑀 =𝛼 Example Use Implicit Euler’s method with h = 1, to approximate 𝑦(2) Explicit Euler’s Method 𝑦 β€² = 𝑑 1+ 𝑦 ≀ 𝑑 ≀4, 𝑦(1) =1 𝑀 𝑖+1 = 𝑀 𝑖 +β„Žπ‘“ 𝑑 π’Š , 𝑀 π’Š 𝑀 =𝛼 Implicit Euler 𝑀 𝑖+1 = 𝑀 𝑖 + β„Ž 𝑑 𝑖 𝑀 𝑖+1 2 𝑀 1 = 𝑀 1 2 you need to solve nonlinear equation

17 Sec:5.4 RUNGE-KUTTA METHODS
Explicit and Implicit Euler Explicit Euler’s Method 𝑀 𝑖+1 = 𝑀 𝑖 +β„Žπ‘“ 𝑑 π’Š , 𝑀 π’Š 𝑀 =𝛼 Implicit Euler’s Method Implicit 2ed order Method Implicit 2ed order Method 𝑀 𝑖+1 = 𝑀 𝑖 +β„Ž 𝟏 𝟐 𝑓 𝑑 π’Š , 𝑀 π’Š + 𝟏 𝟐 𝑓 𝑑 π’Š+𝟏 , 𝑀 π’Š+𝟏 𝑀 =𝛼 𝑀 𝑖+1 = 𝑀 𝑖 +β„Žπ‘“ 𝑑 π’Š+𝟏 , 𝑀 π’Š+𝟏 𝑀 =𝛼 predictor-corrector method we will use a predicted value, π’˜ π’Š+𝟏 βˆ— obtained with Explicit Euler to evaluate an approximation to the value π’˜ π’Š+𝟏 at the new point. Predictor: π’˜ π’Š+𝟏 βˆ— = 𝑀 𝑖 +β„Žπ‘“ 𝑑 π’Š , 𝑀 π’Š π’˜ π’Š+𝟏 = 𝑀 𝑖 +β„Ž 𝟏 𝟐 𝑓 𝑑 π’Š , 𝑀 π’Š + 𝟏 𝟐 𝑓 𝑑 π’Š+𝟏 , π’˜ π’Š+𝟏 βˆ— Corrector:

18 Sec:5.4 RUNGE-KUTTA METHODS
ODE Solver in MATLAB Ode45, ode23, ode113, ode15s, ode23s, ode23t, ode23tb, ode15i, Example Example 𝑦 β€² =π’šβˆ’ 𝒕 𝟐 +𝟏 πŸŽβ‰€ 𝒕 β‰€πŸ’, 𝑦(0) = 𝟎.πŸ“ [t,y] = ode23(odefun,tspan,y0) y-t^2+1,[0 4],0.5); plot(t,y);grid on

19 Sec:5.4 RUNGE-KUTTA METHODS
ODE Solver in MATLAB Ode45, ode23, ode113, ode15s, ode23s, ode23t, ode23tb, ode15i, Example Example π’š 𝟏 β€² = π’š 𝟐 [t,y] = ode45(odefun,tspan,y0) π’š 𝟐 β€² = πŸβˆ’ π’š 𝟏 𝟐 π’š 𝟐 βˆ’ π’š 𝟐 πŸŽβ‰€ 𝒕 β‰€πŸπŸŽ, π’š 𝟏 (𝟎) π’š 𝟐 (𝟎) = 𝟐 𝟎 F [y(2); (1-y(1)^2)*y(2)-y(1)]; [t,y] = ode45(F,[0 20],[2; 0]); plot(t,y(:,1),'-o',t,y(:,2),'-o')

20 Sec:25.3 RUNGE-KUTTA METHODS
Solver Problem Type Accuracy When to Use ode45 Nonstiff Medium Most of the time.Β ode45Β should be the first solver you try. ode23 Low ode23Β can be more efficient thanΒ ode45Β at problems with crude tolerances, or in the presence of moderate stiffness. Low to High ode113Β can be more efficient thanΒ ode45Β at problems with stringent error tolerances, or when the ODE function is expensive to evaluate. ode113 ode15s Stiff Low to Medium TryΒ ode15sΒ whenΒ ode45Β fails or is inefficient and you suspect that the problem is stiff. Also useΒ ode15sΒ when solving differential algebraic equations (DAEs). ode23sΒ can be more efficient thanΒ ode15sΒ at problems with crude error tolerances. It can solve some stiff problems for whichΒ ode15sΒ is not effective. ode23sΒ computes the Jacobian in each step, so it is beneficial to provide the Jacobian viaΒ odesetto maximize efficiency and accuracy. If there is a mass matrix, it must be constant. ode23s ode23t UseΒ ode23tΒ if the problem is only moderately stiff and you need a solution without numerical damping.Β  ode23tΒ can solve differential algebraic equations (DAEs). ode23tb LikeΒ ode23s, theΒ ode23tbΒ solver might be more efficient thanΒ ode15sΒ at problems with crude error tolerances. ode15i Fully implicit UseΒ ode15iΒ for fully implicit problemsΒ f(t,y,y’)Β =Β 0Β and for differential algebraic equations (DAEs) of index 1. Sec:25.3 RUNGE-KUTTA METHODS

21 Sec:5.4 RUNGE-KUTTA METHODS

22 Sec:5.4 RUNGE-KUTTA METHODS
The motion of a swinging pendulum under certain simplifying assumptions is described by the second-order differential equation 𝒅 𝟐 𝜽 𝒅 𝒕 𝟐 + π’ˆ 𝑳 𝐬𝐒𝐧 𝜽=𝟎 where L=2 is the length of the pendulum, g β‰ˆ ft/s2 is the gravitational constant of the earth, and ΞΈ is the angle the pendulum makes with the vertical. If, in addition, we specify the position of the pendulum when the motion begins, πœƒ( 𝑑 0 ) = πœ‹ 6 , and its velocity at that point, πœƒβ€²( 𝑑 0 ) =0, we have what is called an initial-value problem. Use midpoint method with h = 0.1 s, compute the angle ΞΈ obtained for this initial-value problems at t = 0, 1, and 2 s.

23 Convert into system of 1st order ode
Sec:5.4 RUNGE-KUTTA METHODS 𝒅 𝟐 𝜽 𝒅 𝒕 𝟐 + π’ˆ 𝑳 𝐬𝐒𝐧 𝜽=𝟎 Convert into system of 1st order ode 𝑦 1 =πœƒ 𝑦 2 = π‘‘πœƒ 𝑑𝑑 𝑑 𝑦 1 𝑑𝑑 = π‘‘πœƒ 𝑑𝑑 𝑑 𝑦 2 𝑑𝑑 = 𝑑 2 πœƒ 𝑑 𝑑 2 𝑑 𝑦 1 𝑑𝑑 = 𝑦 2 𝑑 𝑦 2 𝑑𝑑 =βˆ’ 𝑔 𝐿 sin 𝑦 1 π‘Œβ€² 𝑑 = 𝑑 𝑦 1 𝑑𝑑 𝑑 𝑦 2 𝑑𝑑 π‘Œ 𝑑 = 𝑦 1 (𝑑) 𝑦 2 (𝑑) π‘Œβ€² 𝑑 =𝐹(𝑑,π‘Œ) πœƒ(0) = πœ‹ 6 𝐹 𝑑,π‘Œ = 𝑦 2 βˆ’ 𝑔 𝐿 sin 𝑦 1 πœƒβ€²(0) =0 π‘Œ 0 = πœ‹/6 0

24 Sec:5.4 RUNGE-KUTTA METHODS
𝒅 𝟐 𝜽 𝒅 𝒕 𝟐 + π’ˆ 𝑳 𝐬𝐒𝐧 𝜽=𝟎 π‘Œβ€² 𝑑 =𝐹(𝑑,π‘Œ) 𝐹 𝑑,π‘Œ = 𝑦 2 βˆ’ 𝑔 𝐿 sin 𝑦 1 𝜽(𝟎) = 𝝅 πŸ” πœ½β€²(𝟎) =𝟎 π‘Œ 0 = πœ‹/6 0 Midpoint method π‘Š 𝑖+1 = π‘Š 𝑖 + 𝑲 𝟐 β„Ž π‘Š =𝛼 π‘Š 𝑖 is a vector of size 2Γ—1 𝑲 𝟏 , 𝑲 𝟐 and 𝜢 are vector of size 2Γ—1 𝑲 𝟏 =𝐹 𝑑 𝑖 , π‘Š 𝑖 β„Ž and 𝑑 𝑖 are scalars 𝑲 𝟐 =𝐹 𝑑 𝑖 β„Ž, π‘Š 𝑖 𝑲 𝟏 β„Ž 𝐹: 𝑑, 𝑦 1 𝑦 β†’

25 Remark: use this modified for system
Sec:5.4 RUNGE-KUTTA METHODS Midpoint method clear; clc; L = 2; g=32.17; [ Y(2) ; ... -(g/L)*sin(Y(1))]; t0=0; tf=2; n=1000; h=(tf-t0)/n; alpha = [ pi/6 ; 0 ]; tspan = t0:h:tf; [w] = midpoint(F,tspan,alpha); [tspan',w']; plot(tspan,w(1,:));grid on π‘Š 𝑖+1 = π‘Š 𝑖 + 𝑲 𝟐 β„Ž π‘Š =𝛼 𝑲 𝟏 =𝐹 𝑑 𝑖 , π‘Š 𝑖 𝑲 𝟐 =𝐹 𝑑 𝑖 β„Ž, π‘Š 𝑖 𝑲 𝟏 β„Ž function [w] = midpoint(f,tspan,alpha) w(:,1)=alpha; t(1)=tspan(1); n1=length(tspan)-1; h=tspan(2)-tspan(1); for i=1:n1 K1 = f(t(i),w(:,i)); K2 = f(t(i)+0.5*h,w(:,i)+0.5*h*K1); w(:,i+1)=w(:,i)+(K2)*h; t(i+1)=t(i)+h; end; end π‘Œβ€² 𝑑 =𝐹(𝑑,π‘Œ) 𝐹 𝑑,π‘Œ = 𝑦 2 βˆ’ 𝑔 𝐿 sin 𝑦 1 Remark: use this modified for system π‘Œ 0 = πœ‹/6 0

26 Sec:5.4 RUNGE-KUTTA METHODS
𝒅 𝟐 𝜽 𝒅 𝒕 𝟐 + π’ˆ 𝑳 𝐬𝐒𝐧 𝜽=𝟎 t(:) w(1,:) w(2,:) 𝜽(𝟎) = 𝝅 πŸ” πœ½β€²(𝟎) =𝟎 𝜽 πœ½β€²

27 Sec:5.4 RUNGE-KUTTA METHODS
clear; clc; L = 2; g=32.17; [ Y(2) ; ... -(g/L)*sin(Y(1))]; t0=0; tf=10; n=1000; h=(tf-t0)/n; alpha = [ pi/4 ; 0 ]; tspan = t0:h:tf; [w] = midpoint(F,tspan,alpha); [tspan',w']; plot(tspan,w(1,:));grid on function [w] = midpoint(f,tspan,alpha) w(:,1)=alpha; t(1)=tspan(1); n1=length(tspan)-1; h=tspan(2)-tspan(1); for i=1:n1 K1 = f(t(i),w(:,i)); K2 = f(t(i)+0.5*h,w(:,i)+0.5*h*K1); w(:,i+1)=w(:,i)+(K2)*h; t(i+1)=t(i)+h; end; end π‘Œβ€² 𝑑 =𝐹(𝑑,π‘Œ) 𝐹 𝑑,π‘Œ = 𝑦 2 βˆ’ 𝑔 𝐿 sin 𝑦 1 π‘Œ 0 = 𝝅/πŸ’ 0 𝒕 𝒇 =𝟏𝟎

28 Sec:5.4 RUNGE-KUTTA METHODS

29 Theorem 513 (nth Taylor polynomial in two variables)
Sec:5.4 RUNGE-KUTTA METHODS nth Taylor polynomial in two variables 𝑓 π‘₯ =𝑓 π‘₯ 0 +(π‘₯βˆ’ π‘₯ 0 )𝑓′ π‘₯ (π‘₯βˆ’ π‘₯ 0 ) 2 𝑓′′ π‘₯ (π‘₯βˆ’ π‘₯ 0 ) 3 𝑓′′′ π‘₯ 0 +β‹― Theorem 513 (nth Taylor polynomial in two variables) 1st derivatives 2ed nth derivatives

30 Sec:5.4 RUNGE-KUTTA METHODS
π‘«π’†π’“π’Šπ’—π’‚π’•π’Šπ’π’ Taylor’s Series Methods Initial Value Problem Euler’s Method 𝑀 𝑖+1 = 𝑀 𝑖 +β„Žπ‘“ 𝑑 𝑖 , 𝑀 𝑖 𝑀 =𝛼 𝑦 β€² =𝑓 𝑑,𝑦 𝑦(π‘Ž) =𝛼 (*) π‘Žβ‰€ 𝑑 ≀𝑏, We will use Taylor’s Theorem to derive Euler’s method. Suppose that π’š(𝒕), the unique solution to (*) Taylor’s Series Methods 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 𝒕 π’Š+𝟏 βˆ’π’• π’Š π’š β€² 𝒕 π’Š 𝑑 𝑖+1 βˆ’π‘‘ 𝑖 𝟐 𝑦 β€²β€² 𝒕 π’Š +β‹― 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 𝒕 π’Š+𝟏 βˆ’π’• π’Š π’š β€² 𝒕 π’Š + 𝑑 𝑖+1 βˆ’π‘‘ 𝑖 𝟐 𝑦 β€²β€² πœ‰ 𝑖 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 +π’‰π’šβ€² 𝒕 π’Š 𝒉 2 π’šβ€²β€² 𝒕 π’Š +β‹― 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 +𝒉𝒇 𝒕 π’Š ,𝑦 𝑑 𝑖 𝒉 𝟐 𝒇′ 𝒕 π’Š ,𝑦 𝑑 𝑖 +β‹― 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 +π’‰π’šβ€² 𝒕 π’Š + 𝒉 2 𝑦 β€²β€² πœ‰ 𝑖 𝒇 β€² 𝒕 π’Š ,π’š 𝒕 π’Š = 𝝏 𝝏𝒕 𝒇 𝒕 π’Š ,𝑦 𝑑 𝑖 = 𝒇 𝒕 + 𝒇 π’š π’šβ€² 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 +𝒉𝒇 𝒕 π’Š ,𝑦 𝑑 𝑖 + 𝒉 𝟐 𝑦 β€²β€² πœ‰ 𝑖 𝑦 𝑑 𝑖+1 β‰ˆπ‘¦ 𝑑 𝑖 +𝒉𝒇 𝒕 π’Š ,𝑦 𝑑 𝑖 𝑦 𝑑 𝑖+1 =𝑦 𝑑 𝑖 +𝒉𝒇 𝒕 π’Š ,𝑦 𝑑 𝑖 𝒉 𝟐 𝒇 𝒕 + 𝒇 π’š 𝒇 +β‹― 𝑀 𝑖+1 = 𝑀 𝑖 + 𝒉𝒇 𝒕 π’Š , π’˜ π’Š 𝑦 𝑑 𝑖+1 β‰ˆπ‘¦ 𝑑 𝑖 +𝒉𝒇 𝒕 π’Š ,𝑦 𝑑 𝑖 𝒉 𝟐 𝒇 𝒕 + 𝒇 π’š 𝒇 One way to reduce the error of Euler’s method would be to include higher-order terms of the Taylor series expansion in the solution. 𝑀 𝑖+1 = 𝑀 𝑖 +𝒉𝒇 𝒕 π’Š , 𝑀 𝑖 𝒉 𝟐 𝒇 𝒕 + 𝒇 π’š 𝒇 𝒕 π’Š , 𝑀 𝑖 Higher-order derivatives become increasingly more complicated

31 Sec:5.4 RUNGE-KUTTA METHODS
Taylor’s Series Methods π‘«π’†π’“π’Šπ’—π’‚π’•π’Šπ’π’ Taylor’s Series Methods π’š 𝒕 π’Š+𝟏 =π’š 𝒕 π’Š +𝒉 π’š β€² 𝒕 π’Š + 𝟏 𝟐 𝒉 𝟐 π’š β€²β€² 𝒕 π’Š + 𝟏 πŸ” 𝒉 πŸ‘ π’š β€²β€²β€² 𝒕 π’Š +β‹― π’š 𝒕 π’Š+𝟏 =π’š 𝒕 π’Š +𝒉𝒇+ 𝟏 𝟐 𝒉 𝟐 𝒇 β€² + 𝟏 πŸ” 𝒉 πŸ‘ 𝒇 β€²β€² +β‹― π’š 𝒕 π’Š+𝟏 =π’š 𝒕 π’Š +𝒉 𝒇+ 𝟏 𝟐 𝒉 𝒇 β€² + 𝟏 πŸ” 𝒉 𝟐 𝒇 β€²β€² +β‹― Taylor’s Series Method of order one π’š 𝒕 π’Š+𝟏 =π’š 𝒕 π’Š +𝒉 𝒇+ 𝟏 𝟐 𝒉 𝒇 β€² + 𝟏 πŸ” 𝒉 𝟐 𝒇 β€²β€² +β‹― Euler’s Method Taylor’s Series Method of order two 𝒇 β€² = 𝒇 𝒕 + 𝒇 π’š π’šβ€² = 𝒇 𝒕 + 𝒇 π’š 𝒇 𝒕 π’Š ,π’š 𝒕 π’Š π’š 𝒕 π’Š+𝟏 =π’š 𝒕 π’Š +𝒉 𝒇+ 𝟏 𝟐 𝒉 𝒇 β€² + 𝟏 πŸ” 𝒉 𝟐 𝒇 β€²β€² +β‹― π’˜ π’Š+𝟏 = π’˜ π’Š +𝒉 𝒇+ 𝟏 𝟐 𝒉 𝒇 𝒕 + 𝟏 𝟐 𝒉𝒇 𝒇 π’š 𝒕 π’Š , π’˜ π’Š

32 Taylor series in 2-dimension
Sec:5.4 RUNGE-KUTTA METHODS Midpoint method Mod EulerMethod 𝑀 𝑖+1 = 𝑀 𝑖 +β„Ž 𝑲 𝟏 𝑲 𝟐 𝑀 𝑖+1 = 𝑀 𝑖 +β„Ž 𝑲 𝟐 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟏 =𝑓 𝑑 𝑖 , 𝑀 𝑖 𝑲 𝟐 =𝑓 𝑑 𝑖 β„Ž, 𝑀 𝑖 𝑲 𝟏 β„Ž 𝑲 𝟐 =𝑓 𝑑 𝑖 +β„Ž, 𝑀 𝑖 + 𝑲 𝟏 β„Ž 𝑲 𝟏 =𝒇 𝒕 π’Š , π’˜ π’Š Taylor’s Series Method of order two 𝑲 𝟐 =𝒇 𝒕 π’Š + 𝒑 𝟏 𝒉, π’˜ π’Š + 𝒒 𝟏𝟏 𝑲 𝟏 𝒉 π’˜ π’Š+𝟏 = π’˜ π’Š +𝒉 𝒇+ 𝟏 𝟐 𝒉 𝒇 𝒕 + 𝟏 𝟐 𝒉𝒇 𝒇 π’š 𝒕 π’Š , π’˜ π’Š π’˜ π’Š+𝟏 = π’˜ π’Š +𝒉 𝒂 𝟏 𝑲 𝟏 + 𝒂 𝟐 𝑲 𝟐 Taylor series in 2-dimension + <2ed deriv>+β‹― =𝒇 𝒕 π’Š , π’˜ π’Š + 𝒑 𝟏 𝒉 𝒇 𝒕 𝒕 π’Š , π’˜ π’Š + 𝒒 𝟏𝟏 𝑲 𝟏 𝒉 𝒇 π’š 𝒕 π’Š , π’˜ π’Š 𝑲 𝟐 𝒂 𝟏 𝑲 𝟏 + 𝒂 𝟐 𝑲 𝟐 = 𝒂 𝟏 𝒇+ 𝒂 𝟐 𝒇+ 𝒂 𝟐 𝒑 𝟏 𝒉 𝒇 𝒕 + 𝒂 𝟐 𝒒 𝟏𝟏 𝑲 𝟏 𝒉 𝒇 π’š +β‹― Matching the coefficients of f and its derivatives 𝒂 𝟐 𝒑 𝟏 = 𝟏 𝟐 𝒂 𝟐 𝒒 𝟏𝟏 = 𝟏 𝟐 𝒂 𝟏 + 𝒂 𝟐 =𝟏

33 Sec:5.4 RUNGE-KUTTA METHODS
π‘«π’†π’“π’Šπ’—π’‚π’•π’Šπ’π’ 𝑲 𝟏 =𝒇 𝒕 π’Š , π’˜ π’Š Matching the coefficients of f and its derivatives 𝑲 𝟐 =𝒇 𝒕 π’Š + 𝒑 𝟏 𝒉, π’˜ π’Š + 𝒒 𝟏𝟏 𝑲 𝟏 𝒉 𝒂 𝟏 + 𝒂 𝟐 =𝟏 π’˜ π’Š+𝟏 = π’˜ π’Š +𝒉 𝒂 𝟏 𝑲 𝟏 + 𝒂 𝟐 𝑲 𝟐 𝒂 𝟐 𝒑 𝟏 = 𝟏 𝟐 three equations four unknown We have infinite number of solutions , there are an infinite number of second-order RK methods. 𝒂 𝟐 𝒒 𝟏𝟏 = 𝟏 𝟐 We present two of the most commonly used and preferred versions: 𝒂 𝟐 = 𝟏 𝟐 𝒂 𝟐 =𝟏 Modefied Euler Method Midpoint method

34 Sec:5.4 RUNGE-KUTTA METHODS


Download ppt "Sec:5.4 RUNGE-KUTTA METHODS."

Similar presentations


Ads by Google