Page - 254 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 254 -
Text of the Page - 254 -
254 8 SolvingOrdinaryDifferentialEquations
Fig. 8.26 Comparison of the Runge-Kutta-Fehlberg adaptive method against the Euler-Cromer
scheme for a long timesimulation (200 periods)
8.4.7 TheFourth-OrderRunge-KuttaMethod
The fourth-order Runge-Kutta method (RK4) is clearly the most widely used
methodtosolveODEs. Itspowercomesfromhighaccuracyevenwithnot sosmall
timesteps.
The Algorithm We first just state the four-stagealgorithm:
un+1 =un+Δt
6 (
fn+2fˆn+12 +2f˜n+12 + f¯n+1 )
, (8.59)
where
fˆn+ 1
2 =f(un+ 1
2 Δtfn,tn+12), (8.60)
f˜n+ 1
2 =f(un+ 1
2 Δtfˆn+ 1
2,t
n+12), (8.61)
f¯n+1 =f(un+Δtf˜n+12,tn+1). (8.62)
Application Wecanrunthesamesimulationas inFigs.8.19,8.21,and8.24,for40
periods. The 10 last periods are shown in Fig. 8.27. The results look as impressive
as thoseof the Euler-Cromermethod.
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
- Title
- Programming for Computations – Python
- Subtitle
- A Gentle Introduction to Numerical Simulations with Python 3.6
- Volume
- Second Edition
- Authors
- Svein Linge
- Hans Petter Langtangen
- Publisher
- Springer Open
- Date
- 2020
- Language
- English
- License
- CC BY 4.0
- ISBN
- 978-3-319-32428-9
- Size
- 17.8 x 25.4 cm
- Pages
- 356
- Keywords
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Category
- Informatik