Approximating \(\int_{1}^{2}\dfrac{e^{x}}{x}\, dx\) Using the Trapezoidal Rule

Use the Trapezoidal Rule with \(n=4\) and \(n=6\) to approximate \(\int_{1}^{2} \dfrac{e^{x}}{x}dx\). Express the answer rounded to three decimal places.

Solution  We begin by partitioning the interval \([1,2]\) into four subintervals, each of width \(\Delta x=\dfrac{2-1}{4}=\dfrac{1}{4}\): \[ \left[ 1,\,\dfrac{5}{4}\right]\qquad \left[ \dfrac{5}{4},\,\dfrac{3}{2} \right]\qquad \left[ \dfrac{3}{2},\,\dfrac{7}{4}\right]\qquad \left[ \dfrac{7}{4},\,2\right] \]

The values of \(f ( x) =\dfrac{e^{x}}{x}\) corresponding to each endpoint are \[ \begin{eqnarray*} f(1) &=& e \quad f\!\left( \dfrac{5}{4}\right) = \dfrac{4e^{5/4}}{5}\quad f\!\left( \dfrac{3}{2}\right) =\dfrac{2e^{3/2}}{3}\quad f\!\left( \dfrac{7}{4}\right) = \dfrac{4e^{7/4}}{7}\quad f( 2) =\dfrac{e^{2}}{2} \end{eqnarray*} \]

511

Then, using the Trapezoidal Rule, we get \[ \int_{1}^{2}\dfrac{e^{x}}{x}dx\approx \dfrac{1}{2\cdot 4}\,\left[ e+2\cdot \dfrac{4e^{5/4}}{5}+2\,\cdot \dfrac{2e^{3/2}}{3}+2\,\cdot \dfrac{4e^{7/4}}{7} +\dfrac{e^{2}}{2}\right] \approx 3.069 \]

To approximate \(\int_{1}^{2}\dfrac{e^{x}}{x}\,dx\) using six subintervals, we partition \([1,2]\) into six subintervals, each of width \(\Delta x= \dfrac{2-1}{6}=\dfrac{1}{6}\): \[ \left[ 1,\,\dfrac{7}{6}\right]\! \quad \left[ \dfrac{7}{6},\,\dfrac{4}{3} \right]\! \quad \left[ \dfrac{4}{3},\,\dfrac{3}{2}\right]\! \quad \left[ \dfrac{3}{2},\dfrac{5}{3}\right]\!\quad \left[ \dfrac{5}{3},\dfrac{11}{6} \right]\!\quad \left[ \dfrac{11}{6},2\right] \]

Then, using the Trapezoidal Rule, we get \[ \begin{eqnarray*} \int_{1}^{2}\dfrac{e^{x}}{x}dx\approx \dfrac{1}{2\cdot 6}\,\left[f(1)+2f\! \left( \dfrac{7}{6}\right) +2f\! \left( \dfrac{4}{3}\right) \right.&+& 2f\! \left( \dfrac{3}{2}\right) +2f\! \left( \dfrac{5}{3}\right) \\[5pt] &+& \left. 2f\!\left( \dfrac{11}{6}\right) +f(2) \right] \approx 3.063 \end{eqnarray*} \]