NUMERICAL INTEGRATION Given a set of tabulated values of the integrand f(x), determining the value of x0 f(x) dx is called numerical
integration. The given interval of integration is subdivided into a large number of subintervals of equal width h and the functiontabulated at the points of subdivision is replaced by any one of the interpolatingpolynomials like Newton-Gregorys, Stirlings, Bessels over each of thesubintervals and the integral is evaluated. There ar e several formulae for numerical integration which we shall derive in the sequel.
xn
NEWTON-COTES QUADRATURE FORMULA Let I =aby dx, where y takes the values y0, y1, y2, .......,ynfor x = x0, x1, x2, ......, xn.Let the interval of integration (a, b) be divided into nequal sub-intervals, each of width h =(b-a)/n, so that -x0 = a, x1 = x0 + h, x2 = x0 + 2h, ......., xn= x0 + nh= b. Therefore,I =(x0)(x0+h)f (x) dx Since any x is given by x = x0 + rh and dx = hdr I = h0n f (x+rh)dr = h0n[y0+r y0+(r(r-1)/2!)2y0+(r(r-1)(r-2)/3!)3y0+]dr [by Newtons forward interpolation formula] =nh[y0+(n/2)y0+(n(2n-3)/12)2y0+]
(1)
This is a general quadrature formula and is known as Newton-Cotes quadrature formula. A number of important deductions viz. Trapezoidal rule, Simpsons one-third and three-eighth rules, Weddles rule can be immediately deduced by putting n = 1, 2, 3, and 6, respectively, in formula (1). SIMPSONS ONE-THIRD RULE (n = 2) Putting n = 2 in formula (1) and taking the curve through (x0, y0), (x1, y1) and (x2, y2) as a polynomial of degree two so that differences of order higher than two vanish, we get
f( x) dx=2 h[ y0+y0+(1/6)2 y0] h[6y0(y1-y0)(y2-2y1y0)] =(h/3)(y0+4y1+y2)
x0
(x0+2h)
Similarly,
(x0+2h) (x0+(n-2)h) (x0+4h) (x0+nh)
f (x)dx=(h/3)(y2+4y3+y4),.., f (x)dx=(h/3)(y(n-2)+4y(n-1)+yn)
Adding the above integrals, we get
x0 (x0+nh)
=(h/3)[(y0 + yn) + 4(y1 + y3 + ... + yn1)+ 2(y2 + y4 + ... + yn2)]
which is known as Simpsons one-third rule.
NOTE:-While using this formula, the given interval of integration must be divided into an even number of sub-intervals, since we find the area over two sub-intervals at a time. Problem.:Evaluate 0 0.8(log(x+1)+sin(2x))dx ,where x is in radian, using Simpsons 1/3rd rule. Divide the entire interval into 8 strips. Solution: Analytical solution
FLOWCHART FOR SIMPSONS 1/3RD RULE:
START
y=f(x)
Read xn,x0,n
While(mod(n,2)~=2)
Read n again
h=(xn-xp)/n
ans=0
For i=0 to n-1
If(mod(i,2)~=0)
() Ans=ans+4*f(x0+i*h) () Ans1=f(x0)+f(xn) Area=ans+ans1
Ans=ans+2*f(x0+i*h)
Area=Area*(h/3)
END