Seite - 278 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 278 -
Text der Seite - 278 -
278 8 SolvingOrdinaryDifferentialEquations
a) A forwardfinite differenceapproximationto the derivativef ′(a) reads
u′(tn)≈ u(tn+Δt)−u(tn)
Δt .
We can justify this formula mathematically through Taylor series. Write up the
Taylor series for u(tn +Δt) (around t = tn, as given above), and then solve
the expression with respect tou′(tn). Identify, on the right-hand side, the finite
differenceapproximationandaninfiniteseries.Thisseries is thentheerrorin the
finite differenceapproximation. IfΔt is assumed small (i.e.Δt << 1),Δt will
be much larger thanΔt2, which will be much larger thanΔt3, and so on. The
leading order term in the series for the error, i.e., the error with the least power
ofΔt is a goodapproximationof theerror. Identify this term.
b) Repeata) fora backwarddifference:
u′(tn)≈ u(tn)−u(tn−Δt)
Δt .
This time,writeuptheTaylorseries foru(tn−Δt)around tn.Solvewith respect
to u′(tn), and identify the leading order term in the error. How is the error
comparedto the forwarddifference?
c) A centered difference approximation to the derivative, as explored in Exer-
cise 8.13,canbewritten
u′(tn+ 1
2 Δt)≈ u(tn+Δt)−u(tn)
Δt .
Write up the Taylor series foru(tn) around tn+ 12Δt and the Taylor series for
u(tn +Δt) around tn + 12Δt. Subtract the two series, solve with respect to
u′(tn + 12Δt), identify the finite difference approximation and the error terms
on the right-hand side, and write up the leading order error term. How is this
termcomparedto the ones for the forwardandbackwarddifferences?
d) Can you use the leading order error terms in a)–c) to explain the visual
observations in thenumericalexperiment inExercise8.13?
e) Find the leading order error term in the following standard finite difference
approximationto the second-orderderivative:
u′′(tn)≈ u(tn+Δt)−2u(tn)+u(tn−Δt)
Δt2 .
Hint Expressu(tn±Δt)viaTaylorseriesandinsert theminthedifferenceformula.
Filename:Taylor_differences.pdf.
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