Simpson's Rule - Alternating Pattern
Date: 09/20/97 at 14:49:53 From: Keith Holm Subject: Simpson's rule I'm a computer science student who is trying to apply Simpson's rule to a program, but I do not understand it well enough to proceed. Can somebody give a 10 minute "this is how it works"? The book I have shows a series from low to high bounds, but does not explain the alternating 4F 2F pattern.
Date: 09/20/97 at 16:13:23 From: Doctor Anthony Subject: Re: Simpson's rule I will give you the formula to apply without proof. If you want to see the derivation of the formula, write back and I will go through it in detail. The formula is exact for polynomials up to cubics, so if for some strange reason you wanted to use Simpson's rule to integrate 3x^3 - x^2 -5x -3 then just two equal intervals as wide as you please could be used. In the general case we divide the the total interval into an EVEN number of equal sub-intervals, and the more of these, the more accurate will be the final answer. If you have just two sub-intervals, there will be three ordinates y0, y1 and y2 to be calculated. If you have 4 sub-intervals, then you would have 5 ordinates y0, y1,...., y4 to calculate. It is important to use a standard system for naming the ordinates, e.g. y2 is an even-numbered ordinate, y3 is an odd-numbered ordinate, and the formula requires that you treat these in different ways. So always start with y0; then the formula will work correctly in the form I give it to you. Suppose you divide the total range into n intervals, where n MUST be an even number. This means, of course, that there will be an odd number of ordinates. The first ordinate will be y0; the last ordinate will be yn. The width of the sub-intervals is h. The area under the curve is given by: A = (h/3)[y0 + yn + 4(y1+y3+...+y(n-1)) + 2(y2+y4+...+y(n-2))] In words this formula can be remembered as: (h/3)[First + Last + 4(odd numbered) + 2(even numbered] The First and Last must not appear more than once. Do not include them in the brackets of even-numbered ordinates. Example. Evaluate INT(0 to 2)[sqrt(x^2+1)dx] Divide the range into 4 parts each of width 0.5 Calculate the ordinates in a table as follows: x sqrt(x^2+1) = y ------------------------ 0 1 = y0 0.5 1.118 = y1 1 1.4142 = y2 1.5 1.8027 = y3 2 2.236 = y4 ------------------------- A = (.5/3)[1 + 2.236 + 4(1.118 + 1.8027) + 2(1.4142)] = (1/6)[17.7472] = 2.95786 -Doctor Anthony, The Math Forum Check out our web site! http://mathforum.org/dr.math/
Date: 09/20/97 at 16:57:07 From: keith holm Subject: Re: Simpson's rule Thank you very much, Doctor Anthony and the Math Forum; you were a great help! And I appreciate the fast response time too! Thanks again.
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.