Вы находитесь на странице: 1из 3

MSA / L-6 CSE-3512 - Numerical Methods 27th January, 2005

Numerical Integration
Numerical integration is the process of finding the numerical value of a definite integral
b
I= 
a
f ( x) dx
when a function y = f (x) is not know explicitly. But we are given only a set of values of the function
y = f (x) corresponding to the same values of x.
 To evaluate the integral, we fit up a suitable interpolation polynomial to the given set of values of
f (x) and then integrate it within the desired limits. Here we integrate an approximate interpolation
formula instead of f (x). When this technique is applied on a function of single variable, the
process is called Quadrature.
b
 If f (x) is continuous over the closed interval [a, b], then the integral I = 
a
f ( x) dx represents the
area under the curve y = f (x) bounded by the ordinates x = a, x = b and the x-axis.

Y y = f (x)

a b X
Fig: Area under the curve y = f (x)

General Quadrature formula for equidistant ordinates


Suppose y = f(x) is a function whose values are known at equidistant values of x i.e. f(x0) = y0,
b
f(x0+h) = y1 , f(x0+2h) = y2 , ……., f(x0+nh) = yn. We have to evaluate I =  f ( x) dx.
a
To evaluate I, we have to replace f(x) by a suitable interpolation formula. Let the interval
[a, b] be divided into n subintervals with the division points a = x 0 < x0+h < …… < x0+nh = b
where h is the width of each subinterval.
Approximating f(x) by Newton’s forward interpolation formula we can write the integral as
x 0 nh
I = f (x) dx
x0
x 0 nh
=  x0
(y0 + u Δy0 + u (u-1) / 2! Δ2 y0 + u (u-1) (u-2) / 3! Δ3 y0 + …..) dx
Now, u = (x - x0) / h At x = x0
=> x = x0 +nh u=0
dx / du = h and at x = x0+nh
=> dx = h du u=n
Hence,
n
I = h (y0 + u Δy0 + u2-u / 2 Δ2y0 + u3-3u2+2u / 6 Δ3y0 +……….) dx
0
= h [u y0 + u2/2 Δy0 +( u3/3 - u2/2) Δ2y0 / 2 + (u4/4-3.u3 / 3 + 2.u2 / 2) Δ3y0 / 6 +…………]n
= h [n y0 + n2 / 2 Δy0 + ( n3 / 3 - n2 / 2 ) Δ2y0 / 2! + ( n4 / 4 - n3 + n2 ) Δ3y0 / 3! +…………]
The above equation is called the general quadrature formula or general Gauss Legendre
quadrature formula.
We can obtain different numerical integration formula by assigning n =1, 2, 3 etc in the above
formula.

Page 1 of 3
MSA / L-6 CSE-3512 - Numerical Methods 27th January, 2005

Trapezoidal Rule
Substituting n =1 in the general quadrature formula and neglecting all differences greater than
the first, we get
x 0 h
I1 =  x0
f (x) dx
= h [y0 + 1/2 Δy0] = h [y0 + 1/2 (y1-y0)] = h/2 (2y0 + y1 - y0)
= h/2 (y0 + y1) for the first sub interval [x0, x0+h]
Similarly, we get
x 0 2 h
I2 =  x 0 h
f (x) dx = h/2 (y1 + y2)
x 03h
I3 =  f (x) dx = h/2 (y2 + y3).
x 0 2 h
.
.
x 0  nh
In =  x 0  ( n 1) h
f (x) dx = h/2 (yn-1 + yn)

Combining all these expressions, we obtain


I = I1 + I2 + …………. + In
= h/2 (y0 + y1) + h/2 (y1 + y2) + ……….. + h/2 (yn-1 + yn)
= h/2 [y0 + 2 (y1 + y2 + ………. + yn-1) + yn]
The above formula is known as the trapezoidal rule for numerical integration.
 The geometrical significance of this rule is that the curve y = f(x) is replaced by n straight line
joining the points (x0, y0) and (x1, y1), (x1, y1) and (x2, y2), …. , (xn-1, yn-1) and (xn, yn).
 The area bounded by the curve y = f(x), the ordinates x = x0 and x = xn and the x axis is then
approximately equivalent to the sum of the areas of the n trapezium obtained.
1
Example: Calculate the value 0
x / (1 + x) dx correct up to 3 significant figures taking six
intervals by trapezoidal rule.
Solution: Here we have, f(x) = x / (1 + x) a = 0 b = 1 n = 6
 h = (b - a) / n = (1 – 0) / 6 = 1 / 6
X 0 1/6 2/6 3/6 4/6 5/6 6/6
y = f(x) 0.0 0.14286 0.25000 0.33333 0.40000 0.45454 0.50000
y0 y1 y2 y3 y4 y5 y6
The trapezoidal rule can be written as
I = h/2 [(y0 + y6) + 2 (y1 + y2 + y3 + y4 + y5)]
= 1/12 [ (0.0 + 0.5) + 2 (0.14286 + 0.25 + 0.33333 + 0.4 + 0.45454) ]
= 0.30512
 I = 0.305, correct to 3 significant figures.

Simpon’s 1/3 (One-third) Rule


Substituting n = 2 in the general quadrature formula and neglecting the third and other higher
order differences, we get
x 0 2 h
I1 = 
x0
f (x) dx
= h [2y0 + 2Δy0 + (8 / 3 - 2) Δ2y0 / 2] = h [2y0 + 2Δy0 + 1/3 Δ2y0]
= h [2y0 + 2 (y1 - y0) + 1/3 (y2 - 2y1 + y0)]
= 1/3 h [6y0 + 6y1 - 6y0 + y2 - 2y1 + y0]
= h/3 (y0 + 4y1 + y2)

Page 2 of 3
MSA / L-6 CSE-3512 - Numerical Methods 27th January, 2005

Similarly, we get
x 0 4 h
I2 =  x 0 2 h
f (x) dx = h/3 (y2 + 4y3 + y4)
x 06 h
I3 =  f (x) dx = h/3 (y4 + 4y5 + y6)
x 0 4 h
.
.
x 0  nh
In/2 =  x 0( n 2) h
f (x) dx = h/3 (yn-2 + 4yn-1 + yn)

Combining all these expressions, we obtain


I = I1 + I2 + …………. + In/2
= h/3 [(y0+4y1+y2) + (y2+4y3+y4) +……… + (yn-2+4yn-1+y2)]
= h/3 [y0 + 4 (y1 + y3 + y5 +....+ yn-1) + 2 ( y2 + y4 +.…+ yn-2) + yn]
The above formula is known as Simpson’s one-third rule on simply Simpson’s rule.
 It should be noted that this rule requires the division the whole range into an even number
of subintervals of width h.
Example 4, 5: See Page – 171 [G. Shanker Rao].

Simpson’s 3/8 (Three-eight) Rule


Substituting n = 3 in the general quadrature formula and neglecting all the differences above
Δ3, we get
x 03h
I1 =  x0
f (x) dx
= h [3y0 + 9/2 Δy0 + (9 - 9/2) Δ2y0 / 2 + (81/4 – 27 + 9) Δ3y0 / 6]
= 3h [y0 + 3/2 Δy0 + 3/4 Δ2y0 + 1/8 Δ3y0]
= 3h [y0 + 3/2 (y1-y0) + 3/4 (y2-2y1+y0) + 1/8 (y3-3y2+3y1-y0)]
= 3h/8 [y0 + 3y1 + 3y2 + y3]
Similarly, we get
x 06 h
I2 =  x 03h
f (x) dx = 3h/8 (y3 + 3y4 + 3y5 + y6)
x 09 h
I3 =  f (x) dx = 3h/8 (y6 + 3y7 + 3y8 + y9)
x 06 h
.
.
x 0  nh
In/3 =  x 0  ( n  3) h
f (x) dx = 3h/8 (yn-3 + 3yn-2 + 3yn-1 + yn)

Combining all these expressions, we obtain


I = I1 + I2 + …………. + In/2
= 3h/8 [(y0+3y1+3y2+y3) + (y3+3y4+3y5+y6) + …………+ (yn-3+3yn-2+3yn-1+yn)]
= 3h/8 [(y0 + yn) + 3 (y1 + y2 + y4 + y5 + …+ yn-2 + yn-1) + 2 (y3 + y6 + … + yn-3)]
 Simpson’s 3/8 rule can be applied when the range [a, b] is divided into a number of
subintervals, which must be a multiple of 3.
Example 8: See Page – 174 [G. Shanker Rao].

Weddle’s rule:
Substituting n = 6 in the general quadrature formula and neglecting all differences above Δ6, we get
I = 3h/10 [(y0+yn) + (y2+y4+y8+y10+……+yn-4+yn-2) + 5 (y1+y5+y7+y11+…… +yn-5+yn-4)
+ 6 (y3+y9+y15+ …… +yn-3) + 2 (y6+y12+ …………. +yn-6)]
 Substituting n = 4 in the general quadrature formula and neglecting all differences above Δ 4, we
get the Boole’s rule.

Page 3 of 3

Вам также может понравиться