Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Seite - 284 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

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

Bild der Seite - 284 -

Bild der Seite - 284 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Text der Seite - 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?
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python 3.6
Band
Second Edition
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2020
Sprache
englisch
Lizenz
CC BY 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
356
Schlagwörter
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Kategorie
Informatik
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python