Seite - 152 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 152 -
Text der Seite - 152 -
152 4 SolvingOrdinaryDifferentialEquations
and inserting thefinitedifferenceapproximations tou00 andu0 results in
m unC1 2unCun 1
t2 Cbu nC1 un 1
2 t Cs.un/DFn; (4.81)
whereFn is a short notation forF.tn/. Equation (4.81) is linear in the unknown
unC1, sowecaneasily solve for thisquantity:
unC1 D 2munC b
2 t m un 1C t2.Fn s.un// mC b
2 t 1
:
(4.82)
As in thecasewithoutdamping,weneed toderiveaspecial formula foru1. The
initial conditionu0.0/ D 0 implies also now thatu 1 D u1, andwith (4.82) for
nD0,weget
u1 Du0C t 2
2m .F0 s.u0//: (4.83)
In themoregeneral casewithanonlineardamping termf.u0/,
mu00Cf.u0/Cs.u/DF.t/;
weget
m unC1 2unCun 1
t2 Cf unC1 un 1
2 t Cs.un/DFn;
which isanonlinearalgebraicequation forunC1 thatmustbe solvedbynumerical
methods.Amuchmoreconvenientschemearises fromusingabackwarddifference
foru0,
u0.tn/ u n un 1
t ;
because thedamping termwill thenbeknown, involvingonlyun andun 1, andwe
caneasily solve forunC1.
The downside of the backward difference compared to the centered difference
(4.80) is that it reduces the order of the accuracy in the overall scheme from t2
to t. In fact, the Euler-Cromer scheme evaluates a nonlinear damping term as
f.vn/whencomputingvnC1,andthisisequivalenttousingthebackwarddifference
above. Consequently, the convenience of the Euler-Cromer scheme for nonlinear
dampingcomesat a cost of lowering theoverall accuracyof the scheme fromsec-
ond to first order in t. Using the same trick in the finite difference scheme for
the second-orderdifferential equation, i.e., using thebackwarddifference inf.u0/,
makes this schemeequallyconvenientandaccurateas theEuler-Cromerscheme in
thegeneralnonlinearcasemu00Cf.u0/Cs.u/DF .
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