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

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

Image of the Page - 130 -

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

Text of the Page - 130 -

130 4 SolvingOrdinaryDifferentialEquations haveunC1 on the right-handside. In this case, thedifferenceapproximationon the left-handside is abackwarddifference, v0.tnC1/ v nC1 vn t or v0.tn/ v n vn 1 t : Figure 4.19 illustrates the backward difference. The error in the backward differ- ence is proportional to t, the sameas for the forwarddifference (but the propor- tionality constant in the error termhas different sign). The resultingdiscretization methodfor (4.52) isoften referred toasaBackwardEuler scheme. To summarize, using a forwarddifference for thefirst equation andabackward difference for the second equation results in amuchbettermethod than just using forwarddifferences inbothequations. Thestandardwayofexpressing this scheme inphysics is tochange theorderof theequations, v0 D !2u; (4.53) u0 Dv; (4.54) andapplya forwarddifference to (4.53)andabackwarddifference to (4.54): vnC1 Dvn t!2un; (4.55) unC1 DunC tvnC1 : (4.56) That is, first the velocity v is updated and then the positionu, using themost re- centlycomputedvelocity. There isnodifferencebetween(4.55)–(4.56)and(4.49)– (4.50)with respect to accuracy, so the order of the original differential equations does not matter. The scheme (4.55)–(4.56) goes under the names Semi-implicit Euler4 or Euler-Cromer. The implementation of (4.55)–(4.56) is found in the file osc_EC.py. Thecoreof thecodegoes like Fig.4.19 Illustrationofabackward differenceapproximation to thederivative 4http://en.wikipedia.org/wiki/Semi-implicit_Euler_method
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