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/141-Labs/Lab 02 - New Functions From Old.ipynb
Views: 491
Lab 02 - New Functions From Old
Overview
In this lab, we will use SageMath to create functions and then use these functions to create new funcitons. Also, we will learn how to simplify and expand expressions and how to evaluate them at given values.
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̲ ̲\hspace{.7in} \…Related Course Material
Example 1
Suppose and are functions. There are countless ways to combine these functions to create a new function. Some basic examples of this are , , , and .
We first use SageMath to set and .
Now, we will use and to create the five new functions , , , and .
Observe how SageMath automatically simplified each output. Unforunately, this is not always the case. Consider the expression . We know that this expression can easily simplify to . Type this expression below and see what SageMath returns.
SageMath did not sipmlify the expression, but instead returned exactly what we typed in. We can make SageMath simplify the expression as much as possible by using the command ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{.full_̲simplify()}.
Example 2
Repeat Example 1 using the functions and . Use the command ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{.full_̲simplify()} to fully simplify each expression.
Example 3
Now, set . Find and simplify the functions and .
Note that both and are polynomials, but they are written in factored or compact form. If we want to expand the polynomial, we can use the ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{.full_̲simplify()} command from earlier, or we could use the command.
Use both of these commands to expand and see if they give the same result.
Example 4
Recall that the difference quotient of a function is the expression . We will use SageMath to simplify this expression for the function . First, create the function below.
In order for SageMath to simplify the difference quotient, we need to tell SageMath that is also a variable like . We do this by using the command.
Now, SageMath will treat like a variable. Below, simplify the difference quotient of and assign this expression to the name DiffQuot. Once simplified, the expressions should be a polynomial.
Note that this expression is not completely simplified. Again, we can use the ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 14: \textbf{.full_̲simplify()} command to fully simplify the difference quotient.
Now, the difference quotient is fully simplifed. Suppose we wish to evaluate this new expression at . We can do this by appending after our expression.
Example 5
Repeat Example 4 using the function .
Example 6
Find and fully simplify , , and for the following choices of and .
and
and
Example 7
Let . Note that we can decompose into the composition of the three functions , , and , where
Example 8
Repeat Example 7 with the following with the following choices for , that is, find , , and such that Be sure to check your composition.