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

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

Bild der Seite - 57 -

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

Text der Seite - 57 -

3.2 TheCompositeTrapezoidalRule 57 Proceeding from (3.5), the different integrationmethodswill differ in theway theyapproximateeach integralon the righthandside. The fundamental idea is that each termisan integraloverasmall interval Œxi;xiC1 , andover this small interval, itmakes sense to approximatef bya simple shape, say a constant, a straight line, oraparabola,whichwecaneasily integratebyhand.Thedetailswill becomeclear in thecomingexamples. Computational example To understand and compare the numerical integration methods, it isadvantageoustouseaspecificintegralforcomputationsandgraphical illustrations. Inparticular,wewant tousean integral thatwecancalculatebyhand such that the accuracy of the approximationmethods can easily be assessed. Our specific integral is taken frombasic physics. Assume that you speed up your car from rest andwonder how far you go inT seconds. The distance is given by the integral RT 0 v.t/dt, where v.t/ is the velocity as a function of time. A rapidly increasingvelocity functionmightbe v.t/D3t2et3 : (3.6) Thedistanceafteronesecond is 1Z 0 v.t/dt; (3.7) which is the integral we aim to compute by numericalmethods. Fortunately, the chosen expression of the velocity has a form that makes it easy to calculate the anti-derivativeas V.t/D et3 1: (3.8) Wecan therefore compute the exact valueof the integral asV.1/ V.0/ 1:718 (rounded to3decimals forconvenience). 3.2 TheCompositeTrapezoidalRule The integral Rb a f.x/dxmaybe interpreted as the areabetween thex axis and the graph y D f.x/ of the integrand. Figure 3.1 illustrates this area for the choice (3.7). Computing the integral R1 0 f.t/dt amounts to computing the area of the hatched region. If we replace the true graph in Fig. 3.1 by a set of straight line segments, we mayview thearea rather as composedof trapezoids, the areasofwhichareeasy to compute. This is illustrated inFig. 3.2,where4 straight line segments give rise to 4 trapezoids, covering the time intervals Œ0;0:2/, Œ0:2;0:6/, Œ0:6;0:8/and Œ0:8;1:0 . Note thatwehave taken theopportunityhere todemonstrate thecomputationswith time intervals thatdiffer in size.
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