Example 14.2. Approximating Area using Left-hand and Right-hand Rules.
In this example, we will approximate the signed area between \(f(x) = 10 { e}^{-x}\) and the \(x\)-axis using left-hand and right-hand rectanges. First, we will see how Maple can give the approximate area using a specific number of subintervals (which Maple calls a
partition). These are two common methods that we learn when first calculating Riemann sums.
To start, we will assign function, \(f(x)\text{.}\) and calculate some approximations.
> f(x) := 10*exp(-x);
\begin{equation*}
\displaystyle f\, := \,x\mapsto 10\,{{ e}^{-x}}
\end{equation*}
We will start with using eight subintervals and approximate the area using left-hand and right-hand rectangles. The
method needs to be specified as well as the number of partitions. Maple will give the exact value of this Riemann sum, which can be converted to decimal using the evalf() command.
> with(Student[Calculus1]): > ApproximateInt(f(x), x = 0..4, method=left, output=value, partition=8); evalf(%);
\begin{equation*}
\displaystyle 5+5\,{{ e}^{-1/2}}+5\,{{ e}^{-1}}+5\,{{ e}^{-3/2}}+5\,{{ e}^{-2}}+5\,{{ e}^{-5/2}}+5\,{{ e}^{-3}} +5\,{{ e}^{-7/2}}
\end{equation*}
\begin{equation*}
\displaystyle 12.47472497
\end{equation*}
> ApproximateInt(f(x), x = 0..4, method=right, output=value, partition=8);
evalf(%);
\begin{equation*}
\displaystyle 5\,{{ e}^{-1/2}}+5\,{{ e}^{-1}}+5\,{{ e}^{-3/2}}+5\,{{ e}^{-2}}+5\,{{ e}^{-5/2}}+5\,{{ e}^{-3}}+5\,{{ e}^{-7/2}}+5\,{{ e}^{-4}}
\end{equation*}
\begin{equation*}
\displaystyle 7.566303166
\end{equation*}
If we wish to get the actual area under the curve, then we can use an arbitrary \(n\) rectangles and take the limit as \(n\to\infty\text{.}\)
Aside
> ApproximateInt(f(x), x = 0..4, method=left, output=sum, partition=n);
limit(%, n = infinity); evalf(%);
\begin{equation*}
\displaystyle 4\,{\frac {1}{n}\sum _{i=0}^{n-1}10\,{{ e}^{-4\,{\frac {i}{n}}}}}
\end{equation*}
\begin{equation*}
\displaystyle 10-10\,{{ e}^{-4}}
\end{equation*}
\begin{equation*}
\displaystyle 9.816843611
\end{equation*}
