Calculus

Integration of Functions

Integration of Functions Logo

Simpson’s Rule

Solved Problems

Example 7.

Approximate the integral \[\int\limits_0^2 {{x^3}dx}\] using Simpson's Rule with \(n = 4\) subintervals.

Solution.

The Simpson's Rule formula for \(n = 4\) subintervals has the form

\[{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2\left( {{x_4}} \right)} \right].\]

Determine the width of the subinterval:

\[\Delta x = \frac{{b - a}}{n} = \frac{{2 - 0}}{4} = \frac{1}{2}.\]

The values of the cubic function at the points \({x_i} = \left\{ {0,\frac{1}{2},1,\frac{3}{2},2} \right\}\) are

\[f\left( {{x_0}} \right) = f\left( 0 \right) = {0^3} = 0;\]
\[f\left( {{x_1}} \right) = f\left( {\frac{1}{2}} \right) = {\left( {\frac{1}{2}} \right)^3} = \frac{1}{8};\]
\[f\left( {{x_2}} \right) = f\left( 1 \right) = {1^3} = 1;\]
\[f\left( {{x_3}} \right) = f\left( {\frac{3}{2}} \right) = {\left( {\frac{3}{2}} \right)^3} = \frac{{27}}{8};\]
\[f\left( {{x_4}} \right) = f\left( 2 \right) = {2^3} = 8.\]

Hence

\[\int\limits_0^2 {{x^3}dx} \approx {S_4} = \frac{1}{6}\left[ {0 + 4 \cdot \frac{1}{8} + 2 \cdot 1 + 4 \cdot \frac{{27}}{8} + 8} \right] = \frac{1}{6}\left[ {\frac{1}{2} + 2 + \frac{{27}}{2} + 8} \right] = \frac{{24}}{6} = 4.\]

Example 8.

Using Simpson's Rule with \(n = 4\) subintervals, evaluate the integral \[\int\limits_0^1 {{e^x}dx}.\] Round the answer to \(3\) decimal places.

Solution.

We evaluate the given integral by the formula

\[{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2\left( {{x_4}} \right)} \right].\]

Determine the width of the subinterval:

\[\Delta x = \frac{{b - a}}{n} = \frac{{1 - 0}}{{4}} = \frac{1}{4}.\]

Compute the function values at the endpoints of the subintervals:

\[f\left( {{x_0}} \right) = f\left( 0 \right) = {e^0} = 1;\]
\[f\left( {{x_1}} \right) = f\left( {\frac{1}{4}} \right) = {e^{\frac{1}{4}}} = \sqrt[4]{e} \approx 1.2840;\]
\[f\left( {{x_2}} \right) = f\left( {\frac{1}{2}} \right) = {e^{\frac{1}{2}}} = \sqrt e \approx 1.6487;\]
\[f\left( {{x_3}} \right) = f\left( {\frac{3}{4}} \right) = {e^{\frac{3}{4}}} = \sqrt[4]{{{e^3}}} \approx 2.1170;\]
\[f\left( {{x_4}} \right) = f\left( 1 \right) = {e^1} = e \approx 2.7183;\]

Plugging in the function values into our equation, we get:

\[\int\limits_0^1 {{e^x}dx} \approx {S_4} = \frac{1}{{12}}\left[ {1 + 4 \times 1.2840 + 2 \times 1.6487 + 4 \times 2.1170 + 2.7183} \right] = \frac{1}{{12}} \times 20.6197 = 1.7183 \approx 1.718\]

Example 9.

Using Simpson's Rule with \(n = 2\) subintervals, evaluate the integral \[\int\limits_1^3 {\ln xdx}.\] Round the answer to \(3\) decimal places.

Solution.

We evaluate the integral by the following approximate formula:

\[{S_2} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + f\left( {{x_2}} \right)} \right].\]

The width of the subinterval is

\[\Delta x = \frac{{b - a}}{n} = \frac{{2 - 0}}{{2}} = 1.\]

Calculate the function values at the points \({x_i} = \left\{ {1,2,3} \right\}:\)

\[f\left( {{x_0}} \right) = f\left( 1 \right) = \ln 1 = 0;\]
\[f\left( {{x_1}} \right) = f\left( 2 \right) = \ln 2 \approx 0.6931;\]
\[f\left( {{x_2}} \right) = f\left( 3 \right) = \ln 3 \approx 1.0986;\]

Hence

\[\int\limits_1^3 {\ln xdx} \approx {S_2} = \frac{1}{3}\left[ {0 + 4\ln 2 + \ln 3} \right] \approx \frac{1}{3}\left[ {4 \times 0.6931 + 1.0986} \right] = \frac{1}{3} \times 3.8710 = 1.290\]

Example 10.

Using Simpson's Rule with \(n = 4\) subintervals approximate the area under the sine curve \[f\left( x \right) = \sin x\] between \(x = 0\) and \(x = \pi.\)

Solution.

The Simpson's Rule formula with \(n = 4\) segments is written in the form

\[{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + \left( {{x_4}} \right)} \right].\]

The width of the subinterval is

\[\Delta x = \frac{{b - a}}{n} = \frac{{\pi - 0}}{4} = \frac{\pi }{4}.\]

Calculate the values of the sine function at the points \({x_i} = \left\{ {0,\frac{\pi }{4}, \frac{\pi }{2}, \frac{{3\pi }}{4}, \pi } \right\}:\)

\[f\left( {{x_0}} \right) = f\left( 0 \right) = \sin 0 = 0;\]
\[f\left( {{x_1}} \right) = f\left( {\frac{\pi }{4}} \right) = \sin \frac{\pi }{4} = \frac{{\sqrt 2 }}{2};\]
\[f\left( {{x_2}} \right) = f\left( {\frac{\pi }{2}} \right) = \sin \frac{\pi }{2} = 1;\]
\[f\left( {{x_3}} \right) = f\left( {\frac{{3\pi }}{4}} \right) = \sin \frac{{3\pi }}{4} = \frac{{\sqrt 2 }}{2};\]
\[f\left( {{x_4}} \right) = f\left( \pi \right) = \sin \pi = 0.\]

Now we can substitute these values into our equation and find the approximate value of the area:

\[A = \int\limits_0^\pi {\sin xdx} \approx {S_4} = \frac{\pi }{{12}}\left[ {0 + 4 \cdot \frac{{\sqrt 2 }}{2} + 2 \cdot 1 + 4 \cdot \frac{{\sqrt 2 }}{2} + 0} \right] = \frac{\pi }{{12}}\left( {4\sqrt 2 + 2} \right) = \frac{\pi }{6}\left( {2\sqrt 2 + 1} \right).\]

Example 11.

Using Simpson's Rule with \(n = 4\) subintervals approximate the area under the inverse cosine curve \[f\left( x \right) = \arccos x\] between \(x = -1\) and \(x = 1.\)

Solution.

The Simpson's Rule formula with \(n = 4\) segments has the form

\[{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + \left( {{x_4}} \right)} \right].\]

Determine the width of the subinterval:

\[\Delta x = \frac{{b - a}}{n} = \frac{{1 - \left({-1}\right)}}{4} = \frac{1}{2}.\]

Calculate the values of the inverse cosine at the endpoints of the subintervals:

\[f\left( {{x_0}} \right) = f\left( { - 1} \right) = \arccos \left( { - 1} \right) = \pi ;\]
\[f\left( {{x_1}} \right) = f\left( { - \frac{1}{2}} \right) = \arccos \left( { - \frac{1}{2}} \right) = \frac{{2\pi }}{3};\]
\[f\left( {{x_2}} \right) = f\left( 0 \right) = \arccos 0 = \frac{\pi }{2};\]
\[f\left( {{x_3}} \right) = f\left( {\frac{1}{2}} \right) = \arccos \frac{1}{2} = \frac{\pi }{3};\]
\[f\left( {{x_4}} \right) = f\left( 1 \right) = \arccos 1 = 0.\]

Substituting these values into our equation, we find the area under the curve:

\[A = \int\limits_{ - 1}^1 {\arccos xdx} \approx {S_4} = \frac{1}{6}\left[ {\pi + 4 \cdot \frac{{2\pi }}{3} + 2 \cdot \frac{\pi }{2} + 4 \cdot \frac{\pi }{3} + 0} \right] = \frac{1}{6} \cdot 6\pi = \pi \]
Page 1 Page 2