Seite - 247 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 247 -
Text der Seite - 247 -
8.4 Oscillating1DSystems:ASecondOrderODE 247
Fig. 8.23 Illustration of a centered difference approximation to the derivative
first thinkingofa scalarODE, is to forma centereddifferenceapproximationto the
derivativebetween two timepoints:
u′(tn+ 1
2 Δt)≈ u n+1 −un
Δt .
Thecentereddifferenceformula isvisualized inFig.8.23.Theerror in thecentered
difference is proportional toΔt2, one order higher than the forward and backward
differences,which means that if we halveΔt, the error is more effectively reduced
in the centered difference since it is reduced by a factor of four rather than
two.
The problem with such a centered scheme for the general ODEu′ = f(u,t) is
thatweget
un+1−un
Δt =f(un+12,t
n+12),
which leads to difficulties since we do not know whatun+12 is. However, we can
approximatethevalueoff betweentwotimelevelsbythearithmeticaverageof the
valuesat tn and tn+1:
f(un+ 1
2,t
n+12)≈ 1
2 (f(un,tn)+f(un+1,tn+1)).
This results in
un+1 −un
Δt = 1
2 (f(un,tn)+f(un+1,tn+1)),
which in general is a nonlinear algebraic equation for un+1 if f(u,t) is not a
linear functionofu.Todealwith theunknowntermf(un+1,tn+1),withoutsolving
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