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

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

Bild der Seite - 68 -

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

Text der Seite - 68 -

68 3 Computing Integrals 32 0.8820933014203766 0.8820575578012112 64 0.8820843709743319 0.8820754296107942 128 0.8820821359746071 0.8820799002925637 256 0.8820815770754198 0.8820810181335849 512 0.8820814373412922 0.8820812976045025 1024 0.8820814024071774 0.8820813674728968 2048 0.8820813936736116 0.8820813849400392 4096 0.8820813914902204 0.8820813893068272 8192 0.8820813909443684 0.8820813903985197 16384 0.8820813908079066 0.8820813906714446 32768 0.8820813907737911 0.8820813907396778 65536 0.8820813907652575 0.8820813907567422 131072 0.8820813907631487 0.8820813907610036 262144 0.8820813907625702 0.8820813907620528 524288 0.8820813907624605 0.8820813907623183 1048576 0.8820813907624268 0.8820813907623890 Avisual inspectionof thenumbersshowshowfast thedigits stabilize inbothmeth- ods. It appears that13digits havestabilized in the last two rows. Remark The trapezoidal andmidpointmethods are just two examples in a jungle of nu- merical integration rules. Other famousmethods areSimpson’s rule andGauss quadrature. Theyallwork in thesameway: bZ a f.x/dx n 1X iD0 wif.xi/: That is, the integral is approximated by a sum of function evaluations, where each evaluationf.xi/ is givenaweightwi. Thedifferentmethodsdiffer in the way they construct the evaluation pointsxi and theweightswi. We have used equally spacedpointsxi, buthigheraccuracycanbeobtainedbyoptimizing the locationofxi. 3.4 Testing 3.4.1 ProblemswithBriefTestingProcedures Testing of the programs for numerical integration has so far employed two strate- gies. If we have an exact answer, we compute the error and see that increasing n decreases the error. When the exact answer is not available, we can (as in the comparisonexample in theprevioussection) lookat the integralvaluesandsee that they stabilize asn grows. Unfortunately, these are veryweak test procedures and not at all satisfactory for claiming that the softwarewehaveproduced is correctly implemented. To see this, we can introduce a bug in the application function that calls trapezoidal: instead of integrating 3t2et 3 , we write “accidentally” 3t3et 3 , but keep the same anti-derivativeV.t/et 3 for computing the error. With the bug and
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