systems of odes systems of ordinary differential equations
play

Systems of ODEs Systems of Ordinary Differential Equations - PowerPoint PPT Presentation

1 with Eulers and RKs Methods Dec 4, 2014 Systems of ODEs Systems of Ordinary Differential Equations Solutions of a single first-order differential equations of the form: = , , given =


  1. 1 with Euler’s and RK’s Methods Dec 4, 2014 Systems of ODEs

  2. Systems of Ordinary Differential Equations • Solutions of a single first-order differential equations of the form: 𝑒𝑧 𝑒𝑢 = 𝑔 𝑢, 𝑧 , given 𝑧 𝑢 𝑝 =∝ have been considered • However, many applications give rise to systems of ODEs. A system of n first-order ODEs has the form: ′ = 𝑔 𝑧 1 1 𝑢, 𝑧 1 , 𝑧 2 , … , 𝑧 𝑜 ′ = 𝑔 𝑧 2 2 𝑢, 𝑧 1 , 𝑧 2 , … , 𝑧 𝑜 ... ′ = 𝑔 𝑧 𝑜 𝑜 𝑢, 𝑧 1 , 𝑧 2 , … , 𝑧 𝑜 • The numerical methods that we have discussed so far for a single equation can be extended to apply to a system of equations as well. We start with the simplest Euler’s and then we apply the more accurate RK-4. 2

  3. Euler’s Method: Systems of ODEs • For the purpose of illustration, let’s consider a system of two equations only, written as: 𝑒𝑧 𝑒𝑢 = 𝑔 1 𝑢, 𝑧, 𝑨 𝑒𝑨 𝑒𝑢 = 𝑔 2 𝑢, 𝑧, 𝑨 • And suppose that Euler’s method is applied to solve them. Given the initial values: 𝑧 𝑢 𝑝 = 𝑧 𝑝 z 𝑢 𝑝 = 𝑨 𝑝 3

  4. Euler’s Method for a System of Two Equations • Computational Sequence: 𝐿 1 = 𝑔 1 𝑢 𝑗 , 𝑧 𝑗 , 𝑨 𝑗 𝑀 1 = 𝑔 2 𝑢 𝑗 , 𝑧 𝑗 , 𝑨 𝑗 𝑧 𝑗+1 = 𝑧 𝑗 + ℎ𝐿 1 𝑨 𝑗+1 = 𝑨 𝑗 + ℎ𝑀 1 For 𝑗 = 0, 1, … . , 𝑂 − 1. We can obtain successive approximations 𝑧 1 , 𝑧 2 , 𝑧 3 , 𝑧 4 , … , 𝑧 𝑂 and those 𝑨 1 , 𝑨 2 , 𝑨 3 , 𝑨 4 , … , 𝑨 𝑂 4

  5. Example 𝑒𝑧 𝑒𝑢 = 2𝑧 + 3𝑨, 𝑧 0 = 1 𝑒𝑨 𝑒𝑢 = 2𝑧 + 𝑨, 𝑨 0 = −1 • Using h=0.1 find an approximation for the first step of 𝑧 0.1 , 𝑨 0.1 using Euler’s method • The exact solution for these equations: 𝑧 𝑢 = 𝑓 −𝑢 𝑨 𝑢 = −𝑓 −𝑢 5

  6. Input Data ➢ 𝑔 1 𝑢, 𝑧, 𝑨 = 2𝑧 + 3𝑨 ➢ 𝑔 2 𝑢, 𝑧, 𝑨 = 2𝑧 + 𝑨 ➢ Initial Values: 𝑧 𝑝 = 𝑧 0 = 1; 𝑨 0 = 𝑨 0 = −1 ➢ Step size: h = 0.1 step size h is the same for both equations as t is the only independent variable in the system 6

  7. Example 𝑗 = 0 𝐿 1 = 𝑔 1 𝑢 0 , 𝑧 0 , 𝑨 0 = 2𝑧 0 + 3𝑨 0 = 2 1 + 3 −1 = −1 𝑀 1 = 𝑔 2 𝑢 0 , 𝑧 0 , 𝑨 0 = 2𝑧 0 + 𝑨 0 = 2 1 + −1 = 1 𝑧 1 = 𝑧 0 + ℎ𝐿 1 = 1 + 0.1 −1 = 0.90 𝑨 1 = 𝑨 0 + ℎ𝑀 1 = −1 + 0.1 1 = −0.90 • Exact solution (correct up to two decimals): 𝑧 0.1 = 𝑓 −0.1 = 0.9048 𝑨 0.1 = −𝑓 0.1 = −0.9048 7

  8. How do you report the solution? 𝒋 𝒖 𝒋 𝑳 𝟐 𝑴 𝟐 𝒛 𝒋 𝒜 𝒋 0 0 1 -1 1 0.1 -1 1 0.9000 -0.9000 2 … … … … … … 8

  9. Runge-Kutta: Systems of ODEs 9

  10. Example • For the purpose of illustration, let’s consider a system of two equations only, written as: 𝑒𝑧 𝑒𝑢 = 𝑔 1 𝑢, 𝑧, 𝑨 𝑒𝑨 𝑒𝑢 = 𝑔 2 𝑢, 𝑧, 𝑨 • Given the initial values: 𝑧 𝑢 𝑝 = 𝑧 𝑝 z 𝑢 𝑝 = 𝑨 𝑝 • RK-4 method is applied to solve them. 10

  11. Applied the 4 th Order Runge Kutta Scheme 𝐿 1 = 𝑔 1 𝑢 𝑘 , 𝑧 𝑘 , 𝑨 𝑘 𝑀 1 = 𝑔 2 𝑢 𝑘 , 𝑧 𝑘 , 𝑨 𝑘 𝑧 𝑘+1 = 𝑧 𝑘 + ℎ 𝐿 1 6 + 𝐿 2 3 + 𝐿 3 3 + 𝐿 4 1 𝑢 𝑘 + ℎ 2 , 𝑧 𝑘 + ℎ 𝑘 + ℎ 6 𝐿 2 = 𝑔 2 𝐿 1 , 𝑨 2 𝑀 1 2 𝑢 𝑘 + ℎ 2 , 𝑧 𝑘 + ℎ 𝑘 + ℎ 𝑀 2 = 𝑔 2 𝐿 1 , 𝑨 2 𝑀 1 𝑘 + ℎ 𝑀 1 6 + 𝑀 2 3 + 𝑀 3 3 + 𝑀 4 𝑨 𝑘+1 = 𝑨 6 1 𝑢 𝑘 + ℎ 2 , 𝑧 𝑘 + ℎ 𝑘 + ℎ 𝐿 3 = 𝑔 2 𝐿 2 , 𝑨 2 𝑀 2 2 𝑢 𝑘 + ℎ 2 , 𝑧 𝑘 + ℎ 𝑘 + ℎ 𝑀 3 = 𝑔 2 𝐿 2 , 𝑨 2 𝑀 2 Observe the computation sequence: you compute each slope for each stage, i.e., 𝐿 4 = 𝑔 1 𝑢 𝑘 + ℎ, 𝑧 𝑘 + ℎ𝐿 3 , 𝑨 𝑘 + ℎ𝑀 3 𝐿 1 , 𝑀 1 , 𝐿 2 , 𝑀 2 , 𝐿 3 , 𝑀 3 , 𝐿 4 , 𝑀 4 then 𝑧 𝑘+1 , 𝑨 𝑘+1 𝑀 4 = 𝑔 2 𝑢 𝑘 + ℎ, 𝑧 𝑘 + ℎ𝐿 3 , 𝑨 𝑘 + ℎ𝑀 3 11

  12. Common to both equations 12

Recommend


More recommend