1 / 6

Numerical Integration

Numerical Integration. Simpson’s Method. Trapezoid Method & Polygonal Lines

nuncio
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 Simpson’s Method

  2. Trapezoid Method & Polygonal Lines One way to view the trapezoid method for integration is that the curves that you are attempting to estimate the integral of is being fitted with a polygonal line (a bunch of connected line segments) and then you compute the area under (or above) each line segment. f(x) b a Simpson’s Method Simpson’s method uses a second degree polynomial (i.e. a quadratic) to estimate the curve you are trying to find the integral of. This is a curve of the form y= c2x2+c1x+c0. The points are assumed to be evenly spaced. To get the estimate for the integral we will write out the 2nd degree polynomial using the data below to the right and then integrate it. c a c-h b c+h h h

  3. We will begin with the special case with the value of c being zero. We begin by integrating the 2nd degree polynomial p(t)=c2t2+c1t+c0. We will simplify it some after integrating it. Substitute c0 and c2 values.

  4. Shifting this over on any closed interval [a,b] we are interested in this becomes the same formula. On 2 partitions this formula becomes: f(x) b a In general this will become a kind of strange sum. Each of the function values will either be multiplied by 4 or 2 except for the first or the last. The number of subinterval points will need to be even.

  5. Example Estimate the integral to the right with 4 subintervals. A partition with 3 subintervals can not be used here since 3 is odd. Partition size 2 In general the sum to estimate the integral can be split into 3 parts. One is the value at the two endpoints, the other two are the odd indexes and the even indexes. This is something important when it comes to implementation. even index odd index odd index even index

  6. even index odd index odd index even index Algorithm for Simpson’s Method function intf( a, b, n) deltax = (b-a)/n isum = f(a)+f(b) oddsum=0 evensum=0 xodd=a+deltax xeven=xodd+deltax for(i=1,i(n/2)-1, i++, evensum = evensum + f(xeven) oddsum = oddsum + f(xodd) xodd = xodd + 2*deltax xeven = xodd + deltax) oddsum = oddsum + f(b-deltax) intf = (1/3)*deltax * (intsum+4*oddsum+2*evensum) prevint = intf(a, b, 2) nextint = intf(a, b, 4) for( i = 3, imaximum iterations && |prevint – nextint|  error, i++, prevint = nextint nextint = intf(a , b, 2i)

More Related