Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Page - 150 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 150 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Image of the Page - 150 -

Image of the Page - 150 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Text of the Page - 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
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2016
Language
English
License
CC BY-NC 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
248
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python