Download presentation
Presentation is loading. Please wait.
Published byBrent Shelton Modified over 8 years ago
1
Introduction to the Runge-Kutta algorithm for approximating derivatives PHYS 361 Spring, 2011
2
review: Euler method General form of first-oder Diff Eq: Example: decay equation To implement a numerical solution, we must approximate the derivative. The Euler method is the simplest approach: Substituting this into our decay equation, we can solve for x i+1 This is equivalent to linearly extrapolating x(t) from x i to x i+1 or... using the Taylor series expansion for x(t) and cutting out all terms involving t 2 or higher. This makes the Euler method “first order accurate” (forward difference)
3
Taylor series Substitute f(x) for dx/dt (from our equation), keep up to 2 nd order in dt This approach is fine if we know df/dx and df/dt
4
Runge-Kutta Same idea as Euler method, but aim for “exact” solution by using the “mean value” slope, instead of the slope at t i. Approximate the mean value slope by evaluating f(x,t) at x m and t m titi t i+1 tmtm make use of Mean value theorem xmxm x Use Euler method to approximate x m : Decay example: 2 nd order R-K has two steps 4 th order R-K has four steps 2 nd order R-K has two steps 4 th order R-K has four steps
5
Runge-Kutta... another approach Approximate mean slope by averaging slopes at t i, t i+1, and t i+1/2 titi t i+1 tmtm xixi x Use weighted average of slopes: Decay example: x i+1 xmxm
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.