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

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

Image of the Page - 129 -

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

Text of the Page - 129 -

4.3 OscillatingOne-DimensionalSystems 129 4.3.4 AMagicFixoftheNumericalMethod In theForwardEuler scheme, unC1 DunC tvn; vnC1 Dvn t!2un; we can replaceun in the last equation by the recently computed valueunC1 from thefirst equation: unC1 DunC tvn; (4.49) vnC1 Dvn t!2unC1 : (4.50) Beforejustifyingthisfixmoremathematically, letus tryitonthepreviousexam- ple. TheresultsappearinFig.4.18.Weseethattheamplitudedoesnotgrow,butthe phase is not entirely correct. After 40periods (Fig. 4.18 right)we see a significant differencebetween thenumerical and theexact solution. Decreasing t decreases the error. For example,with 2000 intervals per period,we only see a small phase errorevenafter50,000periods (!).Wecansafelyconclude that thefixresults inan excellentnumericalmethod! Letusinterprettheadjustedschememathematically. Firstweorder(4.49)–(4.50) such that thedifferenceapproximations toderivativesbecometransparent: unC1 un t Dvn; (4.51) vnC1 vn t D !2unC1 : (4.52) We interpret (4.51) as the differential equation sampled atmesh point tn, because wehavevnontheright-handside. Theleft-handside is thena forwarddifferenceor ForwardEuler approximation to thederivativeu0, seeFig. 4.2. On the other hand, weinterpret (4.52)as thedifferentialequationsampledatmeshpoint tnC1, sincewe Fig.4.18 Adjustedmethod: first threeperiods (left)andperiod36–40 (right)
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