Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis.

Similar presentations


Presentation on theme: "Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis."— Presentation transcript:

1 Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex Systems,” an NSF Expedition in Computing (Award Number 0926200).

2 ODE Numerical Differentiation Definition of Differentiation Problem: We do not have an infinitesimal h Solution: Use a small h as an approximation 2

3 ODE Forward Difference & Backward Difference Forward Difference Backward Difference 3

4 ODE Numerical Differentiation - Example Compute the derivative of function At point x=1.15 4

5 Euler Method Explicit Euler Method Consider Forward Difference Which implies 5

6 Euler Method Explicit Euler Method Split time t into n slices of equal length Δt The Explicit Euler Method Formula 6

7 Euler Method Explicit Euler Method - Algorithm 7

8 Euler Method Implicit Euler Method Consider Backward Difference Which implies 8

9 Euler Method Implicit Euler Method Split the time into slices of equal length The above differential equation should be solved to get the value of y(t i+1 ) Extra computation Sometimes worth because implicit method is more accurate 9

10 Euler Method A Simple Example Try to solve IVP What is the value of y when t=0.5? The analytical solution is 10

11 Using explicit Euler method We choose different dts to compare the accuracy 11 Euler Method A Simple Example

12 texactdt=0.05errordt=0.025errordt=0.012 5 error 0.11.100161.100300.000141.100220.000061.100190.00003 0.21.201261.201770.000501.201510.000241.201380.00011 0.31.304181.305250.001071.304700.000521.304440.00025 0.41.409681.411500.001821.410570.000891.410120.00044 0.51.518461.521210.002741.519820.001351.519140.00067 12 At some given time t, error is proportional to dt. Euler Method A Simple Example

13 For some equations called Stiff Equations, Euler method requires an extremely small dt to make result accuracy The Explicit Euler Method Formula The choice of Δt matters! 13 Euler Method A Simple Example

14 Assume k=5 Analytical Solution is Try Explicit Euler Method with different dts 14 Euler Method A Simple Example

15 Choose dt=0.002, s.t. Works! 15

16 Choose dt=0.25, s.t. Oscillates, but works. 16

17 Choose dt=0.5, s.t. Instability! 17

18 Euler Method Stiff Equation – Explicit Euler Method For large dt, explicit Euler Method does not guarantee an accurate result 18 texactdt=0.5errordt=0.25errordt=0.002error 0.40.13533516.389056-0.252.8472640.133980.010017 0.80.018316-1.582.897225-0.0156251.8530960.0179510.019933 1.20.0024792.25 906.71478 5-0.0009771.3939730.0024050.02975 1.60.000335-3.375 10061.733 21-0.0000611.1819430.0003220.039469 20.0000455.0625 111507.98 310.0000150.6639030.0000430.04909

19 Euler Method Stiff Equation – Implicit Euler Method Implicit Euler Method Formula Which implies 19

20 Choose dt=0.5, Oscillation eliminated! Not elegant, but works. 20


Download ppt "Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis."

Similar presentations


Ads by Google