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

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

Bild der Seite - 66 -

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

Text der Seite - 66 -

66 3 Computing Integrals In themidpointmethod, we construct a rectangle for every sub-intervalwhere the height equals f at the midpoint of the sub-interval. Let us do this for four rectangles, using the same sub-intervals aswe had for hand calculationswith the trapezoidalmethod: Œ0;0:2/, Œ0:2;0:6/, Œ0:6;0:8/, and Œ0:8;1:0 .Weget 1Z 0 f.t/dt h1f 0C0:2 2 Ch2f 0:2C0:6 2 Ch3f 0:6C0:8 2 Ch4f 0:8C1:0 2 ; (3.18) whereh1,h2,h3, andh4 are thewidths of the sub-intervals, used previouslywith the trapezoidalmethodanddefined in (3.10)–(3.13). Withf.t/D3t2et3, theapproximationbecomes1.632.Comparedwith the true answer (1.718), this is about 5% too small, but it is better thanwhatwe gotwith the trapezoidalmethod (10%)with the same sub-intervals. More rectangles give abetter approximation. 3.3.1 TheGeneralFormula Let us derive a formula for themidpoint method based on n rectangles of equal width: bZ a f.x/dxD x1Z x0 f.x/dxC x2Z x1 f.x/dxC : : :C xnZ xn 1 f.x/dx; hf x0Cx1 2 Chf x1Cx2 2 C : : :Chf xn 1Cxn 2 ; (3.19) h f x0Cx1 2 Cf x1Cx2 2 C : : :Cf xn 1Cxn 2 : (3.20) This summaybewrittenmorecompactlyas bZ a f.x/dx h n 1X iD0 f.xi/; (3.21) wherexi D aC h 2 C ih.
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