Download presentation
Presentation is loading. Please wait.
Published byElmer Fisher Modified over 9 years ago
1
Numerical Integration Midpoint Integration
2
Numerical Integration The problem of finding a value for certain integrals is one of the first problems that was attempted by numerical methods. There are certain integrals whose values are necessary to be able to do basic calculations, but at the same time the integrals do not have a closed form antiderivative for the integrand. This does not allow the application of the Fundamental Theorem of Calculus (this is the way that you have gotten used to evaluating integrals). The classic example is the normal distribution curve in statistics. Terminology A partition (of size n ) of an interval [ a, b ] is a set of points: a = x 0 < x 1 < x 2 < x 3 < … < x n = b A regular partition has all the points equally spaced Each pair of consecutive points forms a subinterval [ x i, x i +1 ]. Midpoint Integration One of the easiest integration methods to implement (although not very efficient computationally) is the midpoint method of integration. This uses a series of rectangles to estimate the value of the integral with the height of each rectangle the function value evaluates at the midpoint of each subinterval.
3
a=x 0 x1x1 x2x2 x 3 =b f(x) The diagram to the right shows a regular partition of size three. The yellow, blue and green rectangles are the estimates for the midpoint method. Accuracy & Measuring Error As the number of points n in a regular partition increases the absolute error between the midpoint method estimate and the actual value of the integral decreases. We can form a sequence of estimates based on the number of points in a regular partition n, since the points in the partition are completely determined by the number n. Call the value of each midpoint estimate M n. Any of the measurements of errors in sequences can then be used, most commonly the standard Cauchy error.
4
Algorithm for Midpoint Method function intf ( a, b, n ) deltax = ( b - a )/ n mid = a + deltax /2 intsum = 0 for( i =1, i n, i ++, intsum = intsum + f(mid) mid = mid + deltax ) intf = deltax * intsum prevint = intf (a, b, 2) nextint = intf (a, b, 3) for( i = 4, i maximum iterations && |prevint – nextint| error, i++, prevint = nextint nextint = intf ( a, b, i ) Formula for Midpoint Method with a partition of size n
5
Example Estimate the integral to the right with a partition of size 3 and a partition of size 4. Partition size 3 Partition size 4
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.