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

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

Image of the Page - 152 -

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

Text of the Page - 152 -

152 4 SolvingOrdinaryDifferentialEquations and inserting thefinitedifferenceapproximations tou00 andu0 results in m unC1 2unCun 1 t2 Cbu nC1 un 1 2 t Cs.un/DFn; (4.81) whereFn is a short notation forF.tn/. Equation (4.81) is linear in the unknown unC1, sowecaneasily solve for thisquantity: unC1 D 2munC b 2 t m un 1C t2.Fn s.un// mC b 2 t 1 : (4.82) As in thecasewithoutdamping,weneed toderiveaspecial formula foru1. The initial conditionu0.0/ D 0 implies also now thatu 1 D u1, andwith (4.82) for nD0,weget u1 Du0C t 2 2m .F0 s.u0//: (4.83) In themoregeneral casewithanonlineardamping termf.u0/, mu00Cf.u0/Cs.u/DF.t/; weget m unC1 2unCun 1 t2 Cf unC1 un 1 2 t Cs.un/DFn; which isanonlinearalgebraicequation forunC1 thatmustbe solvedbynumerical methods.Amuchmoreconvenientschemearises fromusingabackwarddifference foru0, u0.tn/ u n un 1 t ; because thedamping termwill thenbeknown, involvingonlyun andun 1, andwe caneasily solve forunC1. The downside of the backward difference compared to the centered difference (4.80) is that it reduces the order of the accuracy in the overall scheme from t2 to t. In fact, the Euler-Cromer scheme evaluates a nonlinear damping term as f.vn/whencomputingvnC1,andthisisequivalenttousingthebackwarddifference above. Consequently, the convenience of the Euler-Cromer scheme for nonlinear dampingcomesat a cost of lowering theoverall accuracyof the scheme fromsec- ond to first order in t. Using the same trick in the finite difference scheme for the second-orderdifferential equation, i.e., using thebackwarddifference inf.u0/, makes this schemeequallyconvenientandaccurateas theEuler-Cromerscheme in thegeneralnonlinearcasemu00Cf.u0/Cs.u/DF .
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