Seite - 55 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 55 -
Text der Seite - 55 -
3ComputingIntegrals
We now turn our attention to solving mathematical problems through computer
programming.Therearemanyreasonstochooseintegrationasourfirstapplication.
Integration is well known already from high schoolmathematics. Most integrals
are not tractable by pen and paper, and a computerized solution approach is both
verymuchsimplerandmuchmorepowerful–youcanessentially treatall
integralsRb
a f.x/dx in 10 lines of computer code (!). Integration also demonstrates the
differencebetweenexactmathematicsbypenandpaperandnumericalmathematics
on a computer. The latter approaches the result of the formerwithout anyworries
aboutroundingerrorsduetofiniteprecisionarithmetics incomputers(incontrast to
differentiation,where sucherrorspreventus fromgettinga result asaccurateaswe
desire on the computer). Finally, integration is thought of as a somewhat difficult
mathematical concept to grasp, and programming integration should greatly help
with theunderstandingofwhat integration is andhowitworks. Not only shallwe
understand how to use the computer to integrate, but we shall also learn a series
of good habits to ensure your computer work is of the highest scientific quality.
In particular, we have a strong focus on how towrite Python code that is free of
programmingmistakes.
Calculatingan integral is traditionallydoneby
bZ
a f.x/dxDF.b/ F.a/; (3.1)
where
f.x/D dF
dx :
55©TheAuthor(s)2016
S.Linge,H.P.Langtangen,Programming for Computations –Python,
Texts inComputational Science andEngineering15,DOI10.1007/978-3-319-32428-9_3
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