Seite - 150 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 150 -
Text der Seite - 150 -
150 4 SolvingOrdinaryDifferentialEquations
wejust insert theapproximation(4.74) toget
unC1 2unCun 1
t2 D !2un: (4.75)
Wenowassume thatun 1 andun arealreadycomputedand thatunC1 is thenew
unknown. Solvingwith respect tounC1gives
unC1 D2un un 1 t2!2un: (4.76)
Amajorproblemariseswhenwewant to start the scheme.Weknowthatu0 D
U0, butapplying (4.76) fornD0 to computeu1 leads to
u1 D2u0 u 1 t2!2u0; (4.77)
wherewedonotknowu 1. Theinitialconditionu0.0/D0canhelpus toeliminate
u 1 - andthisconditionmustanywaybe incorporated insomeway. To thisend,we
discretizeu0.0/D0byacentered difference,
u0.0/ u 1 u 1
2 t D0:
It follows thatu 1 Du1, andwecanuse this relation toeliminateu 1 in (4.77):
u1 Du0 1
2 t2!2u0 : (4.78)
Withu0 DU0 andu1 computed from(4.78),we can computeu2,u3, and so forth
from(4.76). Exercise4.19asksyou toexplorehowthestepsabovearemodified in
casewehaveanonzero initial conditionu0.0/DV0.
Remarkonasimplermethodforcomputingu1
Wecouldapproximate the initial conditionu0.0/bya forwarddifference:
u0.0/ u 1 u0
t D0;
leading tou1 D u0. Thenwe can use (4.76) for the coming time steps. How-
ever, this forwarddifferencehas anerrorproportional to t,while the centered
differencewe used has an error proportional to t2, which is compatiblewith
the accuracy (error goes like t2) used in the discretization of the differential
equation.
Themethod for the second-order ODE described above goes under the name
Störmer’smethodorVerlet integration7. It turnsout that thismethod ismathemat-
ically equivalentwith theEuler-Cromer scheme(!). Ormoreprecisely, thegeneral
formula (4.76) is equivalentwith theEuler-Cromer formula,but theschemefor the
7http://en.wikipedia.org/wiki/Verlet_integration
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python
- Titel
- Programming for Computations – Python
- Untertitel
- A Gentle Introduction to Numerical Simulations with Python
- Autoren
- Svein Linge
- Hans Petter Langtangen
- Verlag
- Springer Open
- Datum
- 2016
- Sprache
- englisch
- Lizenz
- CC BY-NC 4.0
- ISBN
- 978-3-319-32428-9
- Abmessungen
- 17.8 x 25.4 cm
- Seiten
- 248
- Schlagwörter
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Kategorie
- Informatik