Page - 139 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Image of the Page - 139 -
Text of the Page - 139 -
4.3 OscillatingOne-DimensionalSystems 139
Fig.4.24 The last10of40periodsofoscillationsby the4th-orderRunge-Kuttamethod
Thealgorithm Wefirst just state the four-stagealgorithm:
unC1 DunC t
6 fnC2 OfnC12 C2 QfnC12 C NfnC1 ; (4.59)
where
OfnC12 Df unC 1
2 tfn;tnC12 ; (4.60)
QfnC12 Df unC 1
2 t OfnC12 ;tnC12 ; (4.61)
NfnC1 Df unC t QfnC12 ;tnC1 : (4.62)
Application WecanrunthesamesimulationasinFigs.4.16,4.18,and4.21,for40
periods. The10 last periodsare shown inFig. 4.24. The results lookas impressive
as thoseof theEuler-Cromermethod.
Implementation The stages in the 4th-order Runge-Kuttamethod can easily be
implemented as amodification of theosc_Heun.py code. Alternatively, one can
use theosc_odespy.pycode by just providing the argumentodespy_methods=
[odespy.RK4] to thecompare function.
Derivation Thederivationof the4th-orderRunge-Kuttamethodcanbepresented
in a pedagogical way that brings many fundamental elements of numerical dis-
cretization techniques together and that illustrates many aspects of “numerical
thinking”whenconstructingapproximatesolutionmethods.
back to the
book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python
- Title
- Programming for Computations – Python
- Subtitle
- A Gentle Introduction to Numerical Simulations with Python
- Authors
- Svein Linge
- Hans Petter Langtangen
- Publisher
- Springer Open
- Date
- 2016
- Language
- English
- License
- CC BY-NC 4.0
- ISBN
- 978-3-319-32428-9
- Size
- 17.8 x 25.4 cm
- Pages
- 248
- Keywords
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Category
- Informatik