Skip to main content

Exploring Calculus with Maple Introductory Calculus

Section 15.1 Definite Integrals

The int() and Int() commands allows us to compute definite and indefinite directly. It is important to know the difference between these two commands:
  • int()
    • This command outputs the the result of the definite or indefinite integral (whenever possible).
    • The palettes toolbar includes definite and indefinite shortcuts that are equivalent to this command.
  • Int()
    • This is the β€œinert” form of the command, which outputs only the definite or indefinite integral itself, without computing the result.
    • This version of the command makes it possible to assign a name to the integral and use it in other commands.
    • The value() command may be applied to the output of an Int() command to compute the result of integration.
Always remember that capitalization is important in Maple.
To see the difference between the two version, we can evaluate the definite integral of \(f(x) = \frac{1}{x^2+1}\) over the interval \([-3,3]\text{.}\)
> f(x) := 1/(1+x^2);
\begin{equation*} \displaystyle f\, := \,x\mapsto \frac{1}{ {x}^{2}+1 } \end{equation*}
> plot(f(x), x=-3..3);
We use the Int() command to display the integral, and the int() command to evaluate the integral. The evalf() command may be used to evaluate the result as a decimal.
> Int(f(x), x=-3..3);
\begin{equation*} \displaystyle \int _{-3}^{3}\! \frac{1}{ {x}^{2}+1 }\,{dx} \end{equation*}
> int(f(x), x=-3..3); evalf(%)
\begin{equation*} \displaystyle 2\,\arctan \left( 3 \right) \end{equation*}
\begin{equation*} \displaystyle 2.498091544 \end{equation*}

Example 15.1. The Net Area under \(g(x) = \ln(x)\) on \([1,10]\).

In this example, we will use a definite integral to determine the net area bounded by \(g(x) = \ln(x)\) and the \(x\)-axis over the interval \([1,10]\text{.}\) We’ll start by assigning the function and looking at a graph of the function to get a better sense of the area.
> g(x) := ln(x);
\begin{equation*} \displaystyle g\, := \,x\mapsto \ln \left( x \right) \end{equation*}
> plot(g(x), x=1..10);
We’ll use the inert command Int() to see how the integral is set up. This can then be combined with value(%) and evalf(%) to have the result computed exactly and as a rounded decimal.
> Int(g(x), x=1..10); value(%); evalf(%);
\begin{equation*} \displaystyle \int _{1}^{10}\! \ln(x)\,{dx} \end{equation*}
\begin{equation*} \displaystyle -9+10\,\ln \left( 2 \right) +10\,\ln \left( 5 \right) \end{equation*}
\begin{equation*} \displaystyle 14.02585093 \end{equation*}

Example 15.2. An Improper Integral.

The int() and Int() commands can also be used to compute improper definite integrals. In this example, we will determine whether the integral
\begin{equation*} \displaystyle \int_{1}^{\infty}\! \frac{1}{x^2}{dx} \end{equation*}
is convergent and if so, its exact value.
To begin, we will assign the function and take a look at its graph. The plot() command may be able to plot a function over an infinite interval. This can produce unpredictable results, so sometimes it is better to simply choose a closed interval with large values of \(x\) instead.
> h(x) := 1/x^2;
\begin{equation*} \displaystyle h\, := \,x\mapsto {x}^{-2} \end{equation*}
> plot(h(x), x=0..infinity);
We’ll start with the inert command, to see how the improper integral is set up. For \(\infty\) in Maple, we type infinity.
> Int(h(x), x=1..infinity);
\begin{equation*} \displaystyle \int _{1}^{\infty }\!{x}^{-2}{dx} \end{equation*}
Next we’ll calculate the result using the lowercase int() command to see if the result is finite.
> int(h(x), x=1..infinity);
\begin{equation*} \displaystyle 1 \end{equation*}
Since the result is finite, this improper integral is convergent.