Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Page - 133 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 133 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 133 -

Image of the Page - 133 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 133 -

6.1 Basic IdeasofNumerical Integration 133 where h= bβˆ’a n . (6.4) That is, we getn sub-intervalsof the same sizeh. Given the integrationpoints, the original integral is re-written as a sum of integrals, each integral being computed over the sub-interval between two consecutive integration points. The integral in (6.2) is thusexpressedas ∫ b a f(x)dx= ∫ x1 x0 f(x)dx+ ∫ x2 x1 f(x)dx+ . . .+ ∫ xn xnβˆ’1 f(x)dx. (6.5) Note thatx0 =a andxn=b. Proceeding from (6.5), the different integration methods will differ in the way theyapproximateeach integralon the righthand side. The fundamental idea is that each termisan integralovera small interval [xi,xi+1], andover this small interval, itmakessense toapproximatef byasimpleshape,sayaconstant,astraight line,or aparabola, thatcanbeeasily integrated.Thedetailswillbecomeclear in thecoming examples. Computational Example To understand and compare the numerical integration methods, it isadvantageoustouseaspecificintegralforcomputationsandgraphical illustrations. In particular, we want to use an integral that we can calculate by hand such that the accuracy of the approximation methods can easily be assessed. Ourspecific integral is takenfrombasicphysics.Assumethatyouspeedupyour car from rest, on a straight road, and wonder how far you go in T seconds. The displacement is given by the integral ∫T 0 v(t)dt, where v(t) is the velocity as a functionof time.A rapidly increasingvelocity functionmightbe v(t)=3t2et3 . (6.6) Thedistance traveled in1s is then ∫ 1 0 v(t)dt, (6.7) which is the integralweaim tocomputebynumericalmethods. By hand,weget ∫ 1 0 3t2et 3 dt= [ et 3 ]1 0 β‰ˆ1.718, (6.8) which is roundedto 3decimals forconvenience.
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python 3.6
Volume
Second Edition
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2020
Language
English
License
CC BY 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
356
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python