NUMERICAL INTEGRATION: Trapezoidal rule Numerical integration simply means the numerical evaluation of π
integrals π° = β«π π(π)π
π Where a and b are given and f(x) is a function given analytically by a formula or empirically by a table of values. We can represent geometrically, I as the area under the curve of f(x) between a and b as shown
Fig 1. Graphical depiction of the trapezoidal rule. Geometrically, the trapezoidal rule is equivalent to approximating the area of the trapezoid under the straight line connecting f (a) and f (b) in fig 1. Recall from geometry that the formula for computing the area of a trapezoid is the height times the average of the bases (Fig2a). In our case, the concept is the same but the trapezoid is on its side (Fig.2b). Therefore, the integral estimate can be represented as I βΌ= width Γ average height
(a) The formula for computing the area of a trapezoid: height times the average of the bases. (b) For the trapezoidal rule, the concept is the same but the trapezoid is on its side or I βΌ= (b β a) Γ average height where, for the trapezoidal rule, the average height is the average of the function values at the end points, or [ f (a) + f (b)]/2.
Generally; Trapezoidal ππ +ππ
π°=β« ππ
π(π)π
π =
rule
is
given
as
π [(ππ + ππ ) + π(ππ + ππ + β― + ππβπ )] π
π
RULES FOR EVALUATING USING β«π π(π)π
π TRAPEZOIDAL RULE OR SIMPSONβS RULE π 1. Compare the given definite integral, say I, with β«π π(π)π
π to get the values of f(x) and limits a, b, πβπ 2. Compute h= , where n denotes the number of sub-intervals π for the problem. 3. Find the values of y=f(x), corresponding to ππ = π, ππ = π + π, ππ = ππ + ππ, β¦ . , ππ = ππ + ππ = π πππ
π
πππππ πππππ ππππππ ππ ππ , ππ , ππ , β¦ . . , ππ. . 4. Apply the specified rule to calculate I (either Trapezoidal rule or Simpsonβs rule).
By trapezoidal rule, we have ππ +ππ
π(π)π
π =
π°=β« ππ
π [(ππ + ππ ) + π(ππ + ππ + β― + ππβπ )] π π
Example: Use Trapezoidal Rule to evaluate β«π ππ π
π considering 5 subintervals. π
Sol. Let π° = β«π ππ π
π. h=0.2, f(x) = ππ
Trapezoidal rule is given by π π° = [(ππ + ππ ) + π(ππ + ππ + β― + ππβπ )] π Putting the values in the above equation, we have π
π° = β« ππ π
π π
π. π [(π + π) + π(π. πππ + π. πππ + π. πππ π + π. πππ)] =
x y=f(x)
0 ππ =π
0.2 0.4 0.6 0.8 1.0 ππ =0.008 ππ =0.064 ππ =0.216 ππ =0.512 ππ =1
=0.26
NUMERICAL INTEGRATION: Simpsonβs rule Another way to obtain a more accurate estimate of an integral is to use higher-order polynomials to connect the points. For example, if there is an extra point midway between f (a) and f (b), the three points can be connected with a parabola (Fig. 3a). If there are two points equally spaced between f (a) and f (b), the four points can be connected with a third-order polynomial (Fig.3b). The formulas that result from taking the integrals under these polynomials are called Simpsonβs rules.
(a) Graphical depiction of Simpsonβs 1/3 rule: It consists of taking the area under a parabola connecting three points. (b) Graphical depiction of Simpsonβs 3/8 rule: It consists of taking the area under a cubic equation connecting four points. π For Simpsonβs rule, the following formula applies; π
ππ +ππ
β« ππ
π(π)π
π π [(ππ + ππ ) + π(ππ + ππ + β― + ππβπ ) + π(ππ + ππ π + β― + ππβπ )] =
π π
π
Example: Evaluate β«π
π
rule taking h=0.25 π dx using Simpsonβs
π+π
π
π
π°=β« π
f(x) =
π+ππ
π
, h=0.25
x y =f(x) π π
π
π° = β«π
π
π π [(ππ + ππ ) + π(ππ + ππ ) + πππ ] = π + ππ π
π+ππ
0 ππ =1 =
π.ππ π
0.25 0.50 ππ =0.9412 ππ =0.8
0.75 ππ =0.64
1.00 ππ =0.5
[(π + π. π) + π(π. ππππ + π. ππ) + π Γ π. π]
= 0.7854
CLASSWORK 1. Given that x 4.0 4.2 4.4 4.6 4.8 5.0 5.2 lo 1.3863 1.4351 1.4816 1.5261 1.5686 1.6094 1.6487 gx π.π
π π
Evaluate β«π πππ π π
π by (i) Trapezoidal Rule (ii) Simpsonβs Rule ANSWERS: (i) 1.82766 (ii)1.82785 π
2. Evaluate β«π ππ ππ πΊππππππβ² ππΉπππ πππππ ππππ π = π. ππ, ππ = π. ππ, ππ = ππ. ππ, ππ = ππ. π ANSWER:53.87 3. A curve is drawn to pass through the points given by the following table: x 1 1.5 2 2.5 3.0 3.5 4.0 y 2 2.4 2.7 2.8 3 2.6 2.1 Estimate the area bounded by the curve, x-axis and the line x=1 and x=4. ANSWER : Area= 7.78 square units 4. The following table gives the velocity v of a particle at time t:
t(seconds) 0 2 4 6 8 10 v(m/sec) 4 6 16 34 60 94 Find the distance moved by the particle in 12 secs. ANSWER: S= 552 m. π
β β«π π πππππ
5. calculate Trapezoidal rule
12 136
π
π correct to four decimal places by