1 / 13

How to solve ODE's in the real world: Runge-Kutta methods

How to solve ODE's in the real world: Runge-Kutta methods. Not the only way, but a good first start!. What is wrong with good old Euler? It is expensive (what do I mean by this?) And you don't know when it is right! Like a measurement without an error!. How did we fix this problem?

reina
Download Presentation

How to solve ODE's in the real world: Runge-Kutta methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to solve ODE's in the real world: Runge-Kutta methods Not the only way, but a good first start!

  2. What is wrong with good old Euler? • It is expensive (what do I mean by this?) • And you don't know when it is right! • Like a measurement without an error!

  3. How did we fix this problem? • we reduced the timestep Dt until the solutions "converged." (define) • should get same answer for t and t/2

  4. But should we not have the computer do this itself? • Runge-Kutta techniques can change step size automatically • They can also take the bigger step sizes and get less error then Euler's method.

  5. So where does error come from? • The faster d(Pop)/dt changes with time, the bigger the error. • Depends on

  6. How do Runge-Kutta algorithms solve these problems? • First, they are more accurate, so less error for a given t • Describe vrs. Euler's • Left-hand side is Euler • Right-hand side is Midpoint or second order Runge-Kutta • Much more accurate than Euler's for a given t

  7. Just as importantly, with Runge-Kutta we automatically see how d(Pop)/dt is changing with t • How? • If d(Pop)/dt is too much, decrease t • If too small, increase t • This is tricky to implement yourself! • Usually best to stick to canned routines.

  8. There are more Runge-Kutta methods… • Very good for smooth solutions; advanced solvers switch between lower order and higher order solutions • Only good when increased t offsets increased number of function evaluations

  9. Example: • Euler with 0.05 day time step • 2nd order Runge-Kutte with variable timestep • note the difference in time step • much faster to solve on computer!

  10. Examine beginning • * are points returned, 'o' are all function evaluations. • Not quite a pure 2nd order RK. (why?) • Note search for optimal timestep

  11. Examine decrease in timesteps? • How/when does it do it? Note peak confusion!

  12. Conclusions: • In real life, never use Euler (almost never…) • Use R-K with adaptive time step • or equivalent • Numerical Recipies (Press et al.) is a good reference • Usually not worth writing your own. • How do you solve it with Matlab? • Monday!

More Related