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 03 - Functions and Plots.ipynb
Views: 491
Lab 03 - Functions and Plots
Overview
In your Calculus course, you will encounter many types of functions. The most beneficial way of understanding how a function behaves is to study its graph. In this lab, we will learn how to use SageMath to create graphs of various functions.
Important SageMath Commands Introduced in this Lab
ParseError: KaTeX parse error: Undefined control sequence: \hfill at position 31: …l|l|l|} \hline \̲h̲f̲i̲l̲l̲ ̲\textbf{Command…Related Course Material
Example 1
SageMath has many built in functions, commands, and constants such as etc. One way to learn more about these is to read the SageMath documentation. The easiest way to do this in the notebook is to use the command.
This command opens up a new window at the bottom of the screen filled with useful information and examples on how to use the function or command. Use SageMath to bring up the documentation for the command and look through all of the available options you have to customize your graph of a function.
We will use this information to plot as an orange dashed line in the viewing window .
Example 2
Plot the function as a green dotted line with the -range being .
Note that if you did not specify a range for the -values, then SageMath chooses the smallest range which will completely fit the graph.
Example 3
Using the documentation as a reference, plot the function from . Change the line thickness to (the default is 1), fill in the area between and the -axis, and add a legend.
Example 4
Suppose we wish to plot multiple functions on the same graph. We can do this using by including lists of functions instead of a single function. Also, if we wish to alter the options for each function in our graph, we can include the options as a list as well.
The code below will plot the function as a green line and the function as an orange line. It will plot them on the domain , will shade in the area between them, and will add a legend.
Example 5
On the same graph, plot the functions and on the viewing window Make each function have a different color and different linestyle. Color in the area between and and add a legend.