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 03 - The u-Substitution Method.ipynb
Views: 491
Lab 03 - The u-Substitution Method
Overview
In this lab, we will use SageMath to perform u-substitutions for both indefinite and definite 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
We will calculate the indefinite integral by using u-substitution. First, we must decide what substitution to make. Since is the inside function and its derivate appears in the integrand, up to a constant multiple, we should let We can use SageMath to handle the u-substitution for us. We start by defining as our integrand and as and then calculating .
Now, we need to substitute both and into our original integral. In order to do this, we first need to solve for in terms of . In this example, it can easily be done by hand to obtain We can also use SageMath to obtain the same result using the command.
Note that SageMath returns both real and complex solutions to the equation when solving for . The function ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{solve_̲for_x} in the package ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{uofsc_̲calculus_labs} will return the expected solution when solving the equation for . To access this function, we must import it from the package by using the command .
If SageMath returns the error stating that there is no module named ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{uofsc_̲caluculus_labs}, then you will first need to install the package using . This can be done in SageMath by running the command below.
If you are using a lab computer or the Binder server, then you will not be able to use ParseError: KaTeX parse error: Unexpected end of input in a macro argument, expected '}' at end of input: \textbf{%pip}; however, ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{uofsc_̲calculus_labs} should already be installed.
Once we have imported the function ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{solve_̲for_x}, we use it to solve the equation for .
SageMath returns as desired. Now we can use SageMath to substitute both and into our original integral.
Therfore, our new integrand is . We can have SageMath display the new integral by using the command along with the parameter which will keep SageMath from evaluating the integral.
It follows that under the u-substitution , we have Now, we can integrate the right integral easily by hand. We see that Finally, we write our final answer back in terms of since that was our starting variable. Hence, we have that
Example 2
Let us use u-substitition to evalaute . We can again use SageMath to perform the u-substitution by repeating the steps in Example 1 with a new integrand and new . In order to save time for future examples, we can package all of the steps together into a function which we will call ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub(f, sub)}.
Before we use ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub} to solve our new problem, let's verify that it works by using it on the integral from Example 1.
It works! Now let us try it with the integral . We have that and . We now use ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub} to rewrite the integral in terms of .
Now, we should be able to integrate the new integral without much trouble and get To get our final answer, we replace with to get We can check our final answer in SageMath by using the normal command. (Don't forget that SageMath does not include the .)
Example 3
Now suppose we wish to evaluate the definite integral We now not only need to rewrite the integrand in terms of , we also have to change the bounds to be in terms of . We can use a modified version of the ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub} function above to accomplish this.
We can now use ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub_with_bounds… to perform a u-substitution on the integral above with integrand and and bounds and .
We are able to solve this definite integral since we know the antiderivative of . We can use SageMath to verify our answer by using the command with our original integrand and bounds.
Example 4
Use the functions ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub} and ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 10: \textbf{u_̲sub_with_bounds… to simply the following integrals by using u-substitition. Then solve the integrals by hand using their simplified form. Lastly, use SageMath to verify that your answer is correct.
ParseError: KaTeX parse error: Got function '\sqrt' with no arguments as superscript at position 22: …aystyle \int_0^\̲s̲q̲r̲t̲{7} x(x^2 + 1)^…