Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Seite - 248 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

Seite - 248 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Bild der Seite - 248 -

Bild der Seite - 248 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Text der Seite - 248 -

248 8 SolvingOrdinaryDifferentialEquations nonlinear equations, we can approximate or predict un+1 using a Forward Euler step: un+1 =un+Δtf(un,tn). This reasoninggives rise to themethod u∗ =un+Δtf(un,tn), (8.57) un+1 =un+Δt 2 (f(un,tn)+f(u∗,tn+1)). (8.58) Theschemeapplies tobothscalar andvectorODEs. Foranoscillatingsystemwithf = (v,−ω2u) thefileosc_Heun.pyimplements thismethod.Thedemofunctioninthatfilerunsthesimulationfor10periodswith20 time steps per period. The correspondingnumerical and exact solutions are shown in Fig. 8.24. We see that the amplitude grows, but not as much as for the Forward Eulermethod.However, theEuler-Cromermethodperformsbetter! We shouldadd that in problemswhere theForwardEulermethodgives satisfac- toryapproximations,suchasgrowth/decayproblemsor theSIRmodel, thesecond- orderRunge-Kuttamethod (Heun’smethod)usuallyworksconsiderablybetter and produces greater accuracy for the same computational cost. It is therefore a very valuablemethod to be aware of, although it cannotcompetewith the Euler-Cromer scheme for oscillation problems. The derivation of the RK2/Heun scheme is also goodgeneral training in “numerical thinking”. Fig. 8.24 Simulationof 10 periods ofoscillationsby Heun’s method
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python 3.6
Band
Second Edition
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2020
Sprache
englisch
Lizenz
CC BY 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
356
Schlagwörter
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Kategorie
Informatik
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python