How do I find the area of a graph using Simpson's rule?
Simpson's rule is a Newton-Cotes formula for approximating the integral of a function f using quadratic polynomials (i.e., parabolic arcs instead of the straight line segments used in the trapezoidal rule). Simpson's rule can be derived by integrating a third-order Lagrange interpolating polynomial fit to the function at three equally spaced points. In particular, let the function f be tabulated at points x_0, x_1, and x_2 equally spaced by distance h, and denote f_n=f(x_n). Then Simpson's rule states that int_(x_0)^(x_2)f(x)dx = int_(x_0)^(x_0+2h)f(x)dx (1) approx 1/3h(f_0+4f_1+f_2). (2) Since it uses quadratic polynomials to approximate functions, Simpson's rule actually gives exact results when approximating integrals of polynomials up to cubic degree.
For example, consider f(x)=sinx (black curve) on the interval [0,pi/2], so that f(x_0=0)=0, f(x_1=pi/4)=1/sqrt(2), and f(x_2=pi/2)=1. Then Simpson's rule (which corresponds to the area under the blue curve obtained from the third-order interpolating polynomial) gives int_0^(pi/2)sinxdx approx 1/3(1/4pi)(0+4/sqrt(2)+1) (3) = 1/(12)(1+2sqrt(2))pi (4) approx 1.00228, (5) whereas the trapezoidal rule (area under the red curve) gives pi/4 approx 0.785398 and the actual answer is 1. In exact form, int_(x_0)^(x_2)f(x)dx = 1/3h(f_0+4f_1+f_2)+1/6int_(x_0)^(x_1)(x_0-t)^2(x_1-t)f^((3))(t)dt+1/6int_(x_1)^(x_2)(x_2-t)^2(x_1-t)f^((3))(t)dt (6) = 1/3h(f_0+4f_1+f_2)+R_n, (7) where the remainder term can be written as R_n=1/(90)h^5f^((4))(x^*), (8) with x^* being some value of x in the interval [x_0,x_2]. An extended version of the rule can be written for f(x) tabulated at x_0, x_1, ..., x_(2n) as int_(x_0)^(x_(2n))f(x)dx=1/3h[f_0+4(f_1+f_3+...+f_(2n-1)) +2(f_2+f_4+...+f_(2n-2))+f_(2n)]-R_n, (9) where the remainder term is R_n=(nh^5)/(90)f^((4))(x^*) (10) for some x^* in [x_0,x_(2n)].
That is ridiculously complicated omg.
i will give an example lets say you want to find the area under the given function f(x)=x^2 from 0..2 so you need first of all step size i am taking n=4 \[\Large \Delta x=\frac{b-a}{n}\] so step size is \[\Large \Delta x=\frac{2-0}{4}=\frac{1}{2}\] now using Simpsons Rule formula we need to Evaluate function at different points since the step size is 0.5 so we ned to Evaluate it at 0,0.5,1,1.5,2 so \[\Large f(x_{0})=(0)^2=0\] \[\Large f(x_{1})=(0.5)^2=0.25\] \[\Large f(x_{2})=(1)^2=1\] \[\Large f(x_{3})=(1.5)^2=2.25\] \[\Large f(x_{4})=(2)^2=4\] using the formula
so Area is \[\Large Area \approx \frac{0.5}{3}[0+4(0.25)+2(1)+4(2.25)+4)=\frac{8}{3}\] wow!!! ..its giving Exact Answer ..
thankyou heaps :)
you are welcome :)
Join our real-time social learning platform and learn together with your friends!