How Does Simpson's Rule Approximate Areas Under Curves?

  • Thread starter Thread starter brandy
  • Start date Start date
  • Tags Tags
    Work
AI Thread Summary
Simpson's Rule approximates the area under a curve using a parabolic interpolation of three points, contrasting with the Trapezoidal Rule, which uses linear segments between two points. The method involves selecting three equally spaced points on the x-axis and fitting a parabola through them. The formula derived from this process allows for the integration of the parabola over the interval defined by these points. To apply Simpson's Rule to a larger dataset, the data must be grouped into sets of three, requiring an odd number of total points to ensure that all intervals can be fully covered by parabolas. This results in a more accurate approximation of the area under the curve compared to simpler methods.
brandy
Messages
156
Reaction score
0
can anyone tell me how it works, like visually, what does it do. I am curious.
iv heard its a three point approximation whereas the trapazoidal rule is a two point approximation. But I am not entirely sure i understand.
 
Mathematics news on Phys.org
The trapezoid method approximates the curve, between successive points, by a straight line while Simpson's rule uses three points at a time and approximates the curve by the parabola passing through the three points.

Suppose your function is f(x) and you take three points, (x_0, f(x_0), (x_1, f(x_1), (x_2, f(x_2)), equally spaced on the x-axis. For simplicity, take the x-values to be x_0= x_1- h, x_1, and x_2= x_1+ h where h is the distance between succesive x values so the points themselves are (x_1- h, f(x_0)), (x_1, f(x_1)), (x_1+ h,f(x_2)).<br /> <br /> The equation of a parabola through (x_1, f(x_1)) can be written y= a(x- x_1)^2+ b(x- x_1)+ f(x_1). Taking x= x_0= x_1- h we get y= f(x_0)= ah^2+ bh+ f(x_1). Taking x= x_2= x_1+ h we get y= f(x_2)= ah^2- bh+ f(x_1).<br /> <br /> Adding those two equations, f(x_2)+ f(x_0)= 2ah^2+ 2f(x_1) so that <br /> ah^2= \frac{f(x_2)+ f(x_0)}{2}- f(x_1}= \frac{f(x_2)- 2f(x_1)+ f(x_0)}{2}]<br /> and<br /> a= \frac{f(x_0)+ 2f(x_1)+ f(x_2)}{2h^2}<br /> <br /> Subtracting those two equations, f(x_2)- f(x_0)= 2bh so that <br /> b= \frac{f(x_2)- f(x_0)}{2h}<br /> <br /> Now, \int_{x_0}^{x_2}a(x-x_1)^2+ b(x-x_1)+ f(x_1) dx= \int_{x_1-h}^{x_1+h} a(x-x_1)^2+ b(x-x_1)+ f(x_1) dx= (1/3)ah^3+ (1/2)bh^2+ f(x_1)h- (1/3)a(-h)^3- b(-h)^2- f(x_1)(-h)= (2/3)ah^3+ 2f(x_1)hso b really isn&amp;amp;#039;t important. The integral of the parabola through (x_1-h, f(x_0)), (x_1, f(x_1)), (x_1+h,f(x_2)) is &amp;lt;br /&amp;gt; (2/3)ah^3+ 2f(x_1)h= (2/3)\frac{f(x_0)- 2f(x_1)+ f(x_2)}{2h^2}h^3+ 2f(x_1)h&amp;lt;br /&amp;gt; = \frac{2(f(x_0)- 2f(x_1)+ f(x_2)}{3}h+ 2f(x_1)h= h\frac{2f(x_0)- 4f(x_1)+ 2f(x_2)}{3}&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; That is the formula for exactly 3 data points. If we have more, we can separte into groups of three and do that for each such interval. Bacause the overlap at the ends, we must have an &amp;lt;b&amp;gt;odd&amp;lt;/b&amp;gt; number of points to do that.&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; For example, if we had only an even number of points, x_0, x_1, x_2, x_3, our first parabola would be over x_0, x_1, x_2 but, even including x_3 as our first endpoint in the next interval we would have only x_2, x_3, not enough for a parabola. But with 5 points, we could have x_0, x_1, x_2, x_2, x_3, x_4. Similarly, with 6 points, an even number, we would have x_0, x_1, x_2, x_2, x_3, x_4, x_4, x_4 and not be able to complete the last parabola but with 7, an odd number, we would have x_0, x_1, x_2, x_2, x_3, x_4, x_4, x_5, x_6.&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; Now see what happens when we &amp;amp;quot;attach&amp;amp;quot; parabolas: on x_0, x_1, x_2 we have &amp;lt;br /&amp;gt; h\frac{2f(x_0)- 4f(x_1)+ 2f(x_2)}{3}&amp;lt;br /&amp;gt; while on x_2, x_3, x_4&amp;lt;br /&amp;gt; h\frac{2f(x_2)- 4f(x_3)+ 2f(x_4)}{3}[/itex]&amp;amp;lt;br /&amp;amp;gt; &amp;amp;lt;br /&amp;amp;gt; Those add to give&amp;amp;lt;br /&amp;amp;gt; h\frac{2f(x_0)- 4f(x_1)+ 4f(x_2)- 4f(x_3)+ 2f(x_4)}{3}[/itex]&amp;amp;amp;lt;br /&amp;amp;amp;gt; so you see why we have &amp;amp;amp;amp;quot;4&amp;amp;amp;amp;quot; multiplying everything except the first and last terms. Taking the integral to be from a to b and using n intervals, h= (b-a)/n so the formula becomes &amp;amp;amp;lt;br /&amp;amp;amp;gt; (b-a)\frac{2f(x_0)- 4f(x_1)+ 4f(x_2)- 4f(x_3)+ 2f(x_4)}{3n}[/itex]&amp;amp;amp;amp;lt;br /&amp;amp;amp;amp;gt; Simpson&amp;amp;amp;amp;amp;#039;s rule.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...
Thread 'Imaginary Pythagoras'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top