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

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

Bild der Seite - 59 -

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

Text der Seite - 59 -

3.2 TheCompositeTrapezoidalRule 59 Theareasof the4trapezoidsshowninFig.3.2nowconstituteourapproximation to the integral (3.7): 1Z 0 v.t/dt h1 v.0/Cv.0:2/ 2 Ch2 v.0:2/Cv.0:6/ 2 Ch3 v.0:6/Cv.0:8/ 2 Ch4 v.0:8/Cv.1:0/ 2 ; (3.9) where h1 D .0:2 0:0/; (3.10) h2 D .0:6 0:2/; (3.11) h3 D .0:8 0:6/; (3.12) h4 D .1:0 0:8/ (3.13) With v.t/ D 3t2et3, each term in (3.9) is readily computed and our approximate computationgives 1Z 0 v.t/dt 1:895: (3.14) Compared to the true answer of 1.718, this is off by about 10%. However, note thatwe used just 4 trapezoids to approximate the area. Withmore trapezoids, the approximationwould have become better, since the straight line segments in the upper trapezoidside thenwouldfollowthegraphmoreclosely.Doinganotherhand calculation with more trapezoids is not too tempting for a lazy human, though, but it is a perfect job for a computer! Let us therefore derive the expressions for approximating the integralbyanarbitrarynumberof trapezoids. 3.2.1 TheGeneralFormula For a given functionf.x/, wewant to approximate the integral Rb a f.x/dx byn trapezoids (of equalwidth). We start outwith (3.5) and approximate each integral on the righthandsidewitha single trapezoid. Indetail, bZ a f.x/dxD x1Z x0 f.x/dxC x2Z x1 f.x/dxC : : :C xnZ xn 1 f.x/dx; hf.x0/Cf.x1/ 2 Chf.x1/Cf.x2/ 2 C : : : Chf.xn 1/Cf.xn/ 2 (3.15)
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