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

Seite - 157 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Bild der Seite - 157 -

Bild der Seite - 157 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Text der Seite - 157 -

4.4 Exercises 157 c) Make plots for comparing the Crank-Nicolson schemewith the Forward and BackwardEuler schemes in thesame test problemas inExercise4.11. Filename:growth_CN.py. Exercise4.13:UnderstandfinitedifferencesviaTaylorseries TheTaylor series aroundapointxDa can fora functionf.x/bewritten f.x/Df.a/C d dx f.a/.x a/C 1 2Š d2 dx2 f.a/.x a/2 C 1 3Š d3 dx3 f.a/.x a/3C : : : D 1X iD0 1 iŠ di dxi f.a/.x a/i : Fora functionof time, as addressed inourODEproblems,wewoulduseu instead off , t insteadofx, anda timepoint tn insteadofa: u.t/Du.tn/C d dt u.tn/.t tn/C 1 2Š d2 dt2 u.tn/.t tn/2 C 1 3Š d3 dt3 u.tn/.t tn/3C : : : D 1X iD0 1 iŠ di dti u.tn/.t tn/i : a) Aforwardfinitedifferenceapproximation to thederivativef 0.a/ reads u0.tn/ u.tnC t/ u.tn/ t : Wecan justify this formulamathematically throughTaylor series.Writeup the Taylor series foru.tn C t/ (around t D tn, as given above), and then solve the expressionwith respect tou0.tn/. Identify, on the right-handside, thefinite difference approximationand an infinite series. This series is then the error in thefinite differenceapproximation. If t is assumedsmall (i.e. t <<1), t will bemuch larger than t2, whichwill bemuch larger than t3, and so on. The leading order term in the series for the error, i.e., the errorwith the least powerof t is agoodapproximationof theerror. Identify this term. b) Repeat a) forabackwarddifference: u0.tn/ u.tn/ u.tn t/ t : This time,writeuptheTaylorseries foru.tn t/around tn. Solvewithrespect to u0.tn/, and identify the leading order term in the error. How is the error compared to the forwarddifference?
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2016
Sprache
englisch
Lizenz
CC BY-NC 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
248
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