Page - 266 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 266 -
Text of the Page - 266 -
266 8 SolvingOrdinaryDifferentialEquations
Fig. 8.34 Effect of nonlinear (left) and linear (right) spring on sliding friction
8.4.12 AFiniteDifferenceMethod;Undamped,LinearCase
We shallnowaddressnumericalmethodsfor thesecond-orderODE
u′′+ω2u=0, u(0)=U0, u′(0)=0, t∈ (0,T],
without rewriting theODEasasystemoffirst-orderODEs.Theprimarymotivation
for“yetanothersolutionmethod”is that thediscretizationprinciplesresult inavery
good scheme, and more importantly, the thinking around the discretization can be
reusedwhensolvingpartialdifferentialequations.
The main idea of this numerical method is to approximate the second-order
derivative u′′ by a finite difference. While there are several choices of difference
approximations to first-order derivatives, there is one dominating formula for the
second-orderderivative:
u′′(tn)≈ u n+1−2un+un−1
Δt2 . (8.74)
The error in this approximation is proportional toΔt2. Letting the ODE be valid at
somearbitrary time point tn,
u′′(tn)+ω2u(tn)=0,
wejust insert theapproximation(8.74) toget
un+1 −2un+un−1
Δt2 =−ω2un. (8.75)
We nowassumethatun−1 andun arealreadycomputedand thatun+1 is thenew
unknown.Solvingwith respect toun+1 gives
un+1 =2un−un−1 −Δt2ω2un. (8.76)
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
- Title
- Programming for Computations – Python
- Subtitle
- A Gentle Introduction to Numerical Simulations with Python 3.6
- Volume
- Second Edition
- Authors
- Svein Linge
- Hans Petter Langtangen
- Publisher
- Springer Open
- Date
- 2020
- Language
- English
- License
- CC BY 4.0
- ISBN
- 978-3-319-32428-9
- Size
- 17.8 x 25.4 cm
- Pages
- 356
- Keywords
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Category
- Informatik