Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/main/142-Labs/Lab 06 - Improper Integrals.ipynb
Views: 491
Lab 06 - Improper Integrals
Overview
In this lab, we will use SageMath to demonstrate the individual steps involved in evaluating improper integrals.
Important SageMath Commands Introduced in this Lab
ParseError: KaTeX parse error: Undefined control sequence: \hfill at position 32: …|l|l|} \hline \̲h̲f̲i̲l̲l̲ ̲\textbf{Command…Related Course Material
Example 1
First, we will evaluate an improper integral which has an unbounded integrand. Consider the integral We can determine if the integrand is unbounded in this interval by graphing it.
Note that the integrand is unbounded as We can confirm this in SageMath by using the command.
We will reformulate this integral using limits as First, we use SageMath to evaluate the integral. In order for SageMath to allow the variable as a bound, we must tell SageMath that is a number greater than so that we avoid the infinite discontinuity. Also, since is a number close to , we also tell SageMath that . We can do this using the command. Also, to see the integral, we use the option to keep SageMath from evaluating the integral and the command.
Recall that SageMath uses to mean , so this is the correct integral. Now we can evaluate the integral, assuming our assumptions are correct, by removing the statement.
Lastly, we use the command to compute the limit of the integral.
It follows that SageMath is capable of handling improper integrals directly, so we can check our answer in SageMath by immediately evaluating the improper integral.
Example 2
Now, let's use SageMath to evaluate an improper integral over an infinite interval. Consider the integral Since both bounds of the integral are infinite, we need to first split the integral into two integrals which have one finite bound. Therefore, we first rewrite the integral as Now, we can rewrite each integral in terms of limits as Let us create both of these integrals in SageMath. We have to be careful when using again since SageMath still remembers the assumptions about it that we made in the last problem. We can check this by using the command.
We can remove all current assumptions on our variables by using the command.
Now that SageMath no longer has any assumptions on , we can use and add new assumptions as needed.
Now, we will use SageMath to evaluate the limit of each of the integrals and add the results together.
Note that we got that Since one of our integrals diverges, we have that the entire integral diverges. Therefore, diverges.
Again, we can check this directly in SageMath. (Read the last line of the error message.)
Example 3
For our last example, we will use SageMath to determine for what values of does converge. First, we rewrite the improper integral using limits as and use SageMath to get simplify the integral.
Note that if we try to evaluate this integral as is, SageMath will throw an error since it needs more information on the variable .
We know that the integrand has two different antiderivatives depending on whether or . Also, we can see that if , then the integrand is a non-decreasing function so the integral will diverge. Therefore, we will look at three cases: , , and . First, let's see what happens when .
We get an expression for the integral. Now let us calculate the limit and see if it converges or diverges.
Since we get an actual expression for the limit, we know that the improper integral converges when . Now, let's see what happens when .
SageMath tells us that this assumption is inconsistent since it is still assumping and it is impossible for and . Therefore, we need to first forget the assumption and then assume .
Now, let us evaluate the integral and limit when .
Since the limit diverges, we know that the improper integral diverges when . Lastly, we will try .
Therefore, we see that the integral also diverges when To summarize, we have that $$\int_1^\infty \dfrac{1}{x^p} \ dx = \left \{ \begin{array}{rl} \dfrac{1}{p-1} & \text{if $p > 1$} \ \text{diverges} & \text{if } \end{array} \right . .$$
Example 4
Repeat the above three examples for the following 3 integrals: