Page - 253 - in Programming for Computations β Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 253 -
Text of the Page - 253 -
8.4 Oscillating1DSystems:ASecondOrderODE 253
Fig. 8.25 Illustration of the impactof resolution (timesteps per period) and length of simulation
easily test theRunge-Kutta-Fehlbergmethodassoonasweknowthecorresponding
Odespyname,which isRKFehlberg:
compare(odespy_methods=[odespy.EulerCromer, odespy.RKFehlberg],
omega=2, X_0=2, number_of_periods=200,
time_intervals_per_period=40)
Note that the time_intervals_per_period argument refers to the time points
where we want the solution. These points are also the ones used for numerical
computationsintheodespy.EulerCromersolver,while theodespy.RKFehlberg
solver will use an unknown set of time points since the time intervals are adjusted
as themethodruns.Onecaneasily lookat thepointsactuallyusedbythemethodas
theseareavailableasanarraysolver.t_all(butplottingorexaminingthepoints
requiresmodifications inside thecomparemethod).
Figure 8.26 shows a computational example where the Runge-Kutta-Fehlberg
methodisclearlysuperior to theEuler-Cromerschemein longtimesimulations,but
thecomparison is not really fair because the Runge-Kutta-Fehlbergmethodapplies
about twice as many time steps in this computationand performsmuch more work
per time step. It is quite a complicated task to compare two so different methods
in a fair way so that the computational work versus accuracy is scientifically well
reported.
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