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

Page - 284 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 284 -

Image of the Page - 284 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 284 -

284 8 SolvingOrdinaryDifferentialEquations by the Odespy software. Let the problem parametersa and b be arguments to the function specifying the derivative. Use 100 time intervals in [0,T] and plot the solutionwhena=2,b=1,T =6/a. Filename:odespy_demo.py. Exercise8.22:Set up aBackwardEuler Scheme forOscillations Write the ODEuβ€²β€² +Ο‰2u= 0 as a system of two first-order ODEs and discretize these with backwarddifferencesas illustrated in Fig. 8.22. The resulting method is referred to as a Backward Euler scheme. Identify the matrix and right-handside of the linear systemthathas tobesolvedateach timelevel. Implement themethod,ei- therfromscratchyourselforusingOdespy(thenameisodespy.BackwardEuler). Demonstrate that contrary to a Forward Euler scheme, the BackwardEuler scheme leads to significant non-physical damping. The figure below shows that even with 60 time stepsperperiod, the results aftera fewperiodsare useless: Filename:osc_BE.py. Exercise8.23:Set up aForwardEuler Scheme forNonlinearandDamped Oscillations Derive a Forward Euler method for the ODE system (8.68)–(8.69). Compare the method with the Euler-Cromer scheme for the sliding friction problem from Sect.8.4.11: 1. Does theForwardEuler schemegivegrowingamplitudes? 2. Is theperiodofoscillationaccurate? 3. What is the required time step size for the two methods to have visually coincidingcurves?
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
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
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python