1 / 5

Numerical Integration

Numerical Integration. Trapezoid Method. Trapezoid Method The trapezoid method for integration we have previously discussed in the first chapter when we talked about a method that can be accelerated.

anneke
Download Presentation

Numerical Integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Numerical Integration Trapezoid Method

  2. Trapezoid Method The trapezoid method for integration we have previously discussed in the first chapter when we talked about a method that can be accelerated. The trapezoid method itself is a much better method than the midpoint method with respect to the size of the partition required to achieve a specified accuracy. The trapezoid method usually requires a smaller number of partitions to meet the error requirements. The Trapezoid method gets is name from using trapezoids instead of rectangles to estimate the area under the curve. f(x) f(x) b a b a Area approximated using 2 trapezoids. Area approximated using 4 trapezoids.

  3. In general any set of points that partition the interval [a,b] can be used as a trapezoidal approximation. We are going to use certain types of partitions that will make the calculation easier. In the partitions we say on the previous slide all had the points equally spaced (i.e. a regular partition). This results in the following convention for the trapezoid approximation with n trapezoids. Add up all the function values in the partition multiplied by 2 except for the a and the b, then multiply by the width of each partition and ½. This will calculate the areas of the trapezoids under the curves.

  4. Algorithm for Trapezoid Method function intf( a, b, n) deltax = (b-a)/n xi = a + deltax intsum = f(a)+f(b) for(i=1,in, i++, intsum = intsum + 2f(xi) xi = xi + deltax) intf = (1/2)*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 Trapezoid 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

More Related