The int() and Int() commands allow us to compute definite and indefinite integrals 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).
To see the difference between the two versions, we can evaluate the definite integral of \(f(x) = \frac{1}{x^2+1}\) over the interval \([-3,3]\text{.}\)
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.
Example15.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.
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.
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.