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

how to debug
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Stiff problems, 2-point BVPs & PDEs Chapters 13, 14

Numerical and Scientific Computing with Applications David F . Gleich CS 314, Purdue November 18, 2016

How to debug ODE methods

Next class

Optimization Chapter 4

Next next class In this class you should learn:

  • Two more methods: Heun’s method

and the RK4 method (book has Simpson’s rule)

  • What goes wrong with Forward

Euler on the Spring System

  • Understand what absolute stability

is and why it is different from stability.

  • How a small set of topics allow us

to understand what is going on with an approximate solution to an ODE

slide-2
SLIDE 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

Notation y(t) |{z}

exact

≈ y(hk) = yk | {z }

  • comp. approx

y∗(t) is exact if otherwise unclear y∗(t) is exact

slide-3
SLIDE 3

Writing Forward Euler as a scheme

y(t) |{z}

exact

≈ y(hk) = yk | {z }

  • comp. approx

y∗(t) is exact

Summary of Notation

y((k + 1)h) = y(kh) + hf(kh, y(hk)) yk+1 = yk + hf(kh, yk) yk+1 = yk + hf(tk, yk) yk+1 = yk + hf(t, yk)

These are all meant to be equivalent ways of writing Forward Euler.

slide-4
SLIDE 4

Heun’s method

yk+1 = yk + h/2[q1 + q2] q1 = f(tk, yk) q2 = f(tk + h, yk + hf(tk, yk)) y(t) |{z}

exact

≈ y(hk) = yk | {z }

  • comp. approx

y∗(t) is exact

Summary of Notation q1 q2 hk h(k+1)

slide-5
SLIDE 5

Runge Kutta methods

Runge-Kutta 4th order method “Related” to a Simpson integration rule. Just a one step method! Julia makes it adaptive in the ode45 routine.

yk+1 = yk + h/6[q1 + 2q2 + 2q3 + q4] q1 = f(tk, yk) q2 = f(tk + h/2, yk + h/2q1) q3 = f(tk + h/2, yk + h/2q2) q4 = f(tk + h, yk + q3)