Skip to main content

Exploring Calculus with Maple Introductory Calculus

Section 14.2 Approximating the Value of a Definite Integral

The ApproximateInt() command is commonly used to approximate the value of a definite integral, particularly when the exact value is computationally difficult, even by computer. To use the command for this purpose, it can be useful to assign a name to an definite integral calculation, using the Int() command. This capitalized version of the command is used to symbolically create an integral without trying to compute it.
Use of the Int() command is fully explained in Definite and Indefinite Integrals.
> int1 := Int(x^2, x=0..2);
\begin{equation*} \displaystyle int\mathit{1}\, := \,\int _{0}^{2}\!{x}^{2}{dx} \end{equation*}
We can evaluate this integral with \(4\) subintervals (each called a partition) using three different methods. We will start with the midpoint rule.
> ApproximateInt(int1, method=midpoint, output=value, partition=4);
\begin{equation*} \displaystyle {\frac {21}{8}} \end{equation*}
The method=trapezoid option uses trapezoids instead of rectangles to approximate the area. This is an average of the left-hand and right-hand rules for rectangle approximation.
> ApproximateInt(int1, method=trapezoid, output=value, partition=4);
\begin{equation*} \displaystyle \frac{11}{4} \end{equation*}
Simpson’s rule is quite a bit more involved. This method uses the right-hand point, left-hand point, and midpoint in each subinterval (partition). It then fits a parabola through these three points and determines the area between each parabolic arc and the \(x\)-axis. As a result, it tends to be the most accurate.
Because of the extra sample point in each partition, the approximation uses twice as many sample points as there are subintervals. For this reason, when we set partition=4, we would typically use \(n=8\) for the formulas used in class.
> ApproximateInt(int1, method=simpson, output=value, partition=4);
\begin{equation*} \displaystyle \frac{8}{3} \end{equation*}
To visualize the approximation using any of the above methods, we use the option output=plot.
> ApproximateInt(int1, method=trapezoid, output=plot, partition=2);
Maple can also give the summation form for any of the above approximations.
> ApproximateInt(int1, method=trapezoid, output=sum, partition=4);
\begin{equation*} \displaystyle \frac{1}{4}\,\sum _{i=0}^{3}\frac{1}{4}\,{i}^{2}+ \left( \frac{1}{2}\,i+\frac{1}{2} \right) ^{2} \end{equation*}