how to debug
play

How to debug Two more methods: Heuns method ODE methods and the - PowerPoint PPT Presentation

Numerical and Scientific Computing with Applications David F . Gleich CS 314, Purdue November 18, 2016 In this class you should learn: How to debug Two more methods: Heuns method ODE methods and the RK4 method (book has Simpsons


  1. Numerical and Scientific Computing with Applications David F . Gleich CS 314, Purdue November 18, 2016 In this class you should learn: How to debug • Two more methods: Heun’s method ODE methods and the RK4 method (book has Simpson’s rule) Next class • What goes wrong with Forward Euler on the Spring System Stiff problems, 2-point BVPs & PDEs • Understand what absolute stability Chapters 13, 14 is and why it is different from stability. Next next class • How a small set of topics allow us Optimization to understand what is going on with Chapter 4 an approximate solution to an ODE

  2. Terminology A “solver” for an ODE is called a Scheme • Method • Integator • Somewhat interchangeably. Scheme – how you go from step k to k+1 • Integrator/Method – Overall approach • y ∗ ( t ) is exact Notation y ( t ) ≈ y ( hk ) = y k |{z} | {z } exact comp. approx y ∗ ( t ) is exact if otherwise unclear

  3. Writing Forward Euler as a scheme y (( k + 1) h ) = y ( kh ) + h f ( kh , y ( hk )) Summary of Notation y k +1 = y k + h f ( kh , y k ) y ∗ ( t ) is exact y k +1 = y k + h f ( t k , y k ) y ( t ) ≈ y ( hk ) = y k y k +1 = y k + h f ( t , y k ) |{z} | {z } exact comp. approx These are all meant to be equivalent ways of writing Forward Euler.

  4. Heun’s method Summary of Notation y k +1 = y k + h / 2[ q 1 + q 2 ] y ∗ ( t ) is exact q 1 = f ( t k , y k ) y ( t ) ≈ y ( hk ) = y k q 2 = f ( t k + h , y k + hf ( t k , y k )) |{z} | {z } exact comp. approx q 2 q 1 h(k+1) hk

  5. Runge Kutta methods Runge-Kutta 4 th order method “Related” to a Simpson integration rule. y k +1 = y k + h / 6[ q 1 + 2 q 2 + 2 q 3 + q 4 ] q 1 = f ( t k , y k ) q 2 = f ( t k + h / 2, y k + h / 2 q 1 ) q 3 = f ( t k + h / 2, y k + h / 2 q 2 ) q 4 = f ( t k + h , y k + q 3 ) Just a one step method! Julia makes it adaptive in the ode45 routine.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend