Seite - 244 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 244 -
Text der Seite - 244 -
244 8 SolvingOrdinaryDifferentialEquations
Fig. 8.20 Simulation of an oscillating system with different time steps. Upper left: 40 steps per
oscillation period. Upper right: 160 steps per period. Lower left: 2000 steps per period. Lower
right:2000 steps perperiod, but longer simulation
wecanreplaceun in the lastequationbytherecentlycomputedvalueun+1 fromthe
first equation:
un+1 =un+Δtvn, (8.49)
vn+1 =vn−Δtω2un+1 . (8.50)
Before justifying this fix more mathematically, let us try it on the previous
example.The results appear in Fig. 8.21.We see that the amplitudedoes not grow,
but the phase is not entirely correct. After 40 periods (Fig. 8.21 right) we see a
significantdifferencebetween the numerical and the exact solution. DecreasingΔt
decreasestheerror.Forexample,with2000intervalsperperiod,weonlyseeasmall
phaseerrorevenafter50,000periods(!).We cansafelyconcludethat thefixresults
inanexcellentnumericalmethod!
Letus interpret theadjustedschememathematically.Firstweorder(8.49)–(8.50)
such that thedifferenceapproximationsto derivativesbecometransparent:
un+1 −un
Δt =vn, (8.51)
vn+1 −vn
Δt =−ω2un+1 . (8.52)
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