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.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Prerequisites:
Intro to Sage
Graphing and Solving Equations
Tangent Lines
Parametric Equations
Suppose and are both functions of a variable , called the "parameter." Then each value of gives a point in the x-y plane, . The set of all such points as varies is called a "parametric curve," and the equations defining this curve are called "parametric equations."
Example 1
Below is an example of a parametric curve. Notice that is not a function of (or vice versa). Graphs of functions form a really limited collection of curves, and parametric curves provide many more kinds of graphs.
Below is an animation which shows the above curve being drawn as starts at and increases to .
You can graph a parametric curve by hand using a table of values - just choose some values of and plug them into the and functions. This is usually pretty tedious.
Sage can handle parametric curves using the parametric_plot command, as in the example above.
First, declare the variable . Then define and . Finally, type parametric_plot((x(t),y(t)),(t,0,pi)). Notice that (t,0,pi) controls which values of are used. You may want to increase pi if the graph looks incomplete.
Example 2
There is a toy called the Spirograph that lets you draw interesting curves using a collection of wheels. We can produce these pictures using Sage.
In the interact below, experiment with different values of and . If the curve looks incomplete, then increase tmax.
For example, try (increase tmax to 100*pi for this one).
Tangents to Parametric Curves
We would like to do calculus with parametric curves, such as finding the slope of the curve.
Example 3
Consider the parametric curve below, which has equations and .
Although is not a function of , it looks like the curve should have tangent lines. How do we find the slope of the tangent line?
By the Chain Rule: .
If , then we can solve for to get
In other words, the slope of the curve in the x-y plane is given by .
Notice that this slope is given as a function of . So if we want the slope of the curve at a particular point , then we need to find a value of that gives us this point.
Example 4
Find an equation for the tangent line to the curve above at .
First, find the slope function. I'll call this function .
Now let's find the slope when .
Next, we calculate and , then we use the point-slope form of a line:
Notice that the tangent line is a function of , not . In order to not interfere with our parametric function , I will use capital for the tangent line.
Intersection Points
What happens to the derivative when the curve crosses itself?
Example 5
In the curve above, the curve intersects itself at .
What values of result in ?
We need a value of that gives both and .
First, we'll ask Sage to solve the equations.
Sage tells us that will work. Is that the only possiblity?
No, we know there are more solutions, since and are both periodic functions. We can get Sage to give us a more complete answer by adding the optional argument to_poly_solve='force' (don't worry about what this does).
In the output above, the variables z45 and z50 are assumed to be any integer (that's what the "z" is for).
In other words, when for any integer , i.e., etc.
On the other hand, when for any integer , i.e. etc.
The values of on both of these lists result in both and being .
Look at the two lists, and see what they have in common. In this case, both lists have .
What is the slope of the curve when ? Let's try a few values of .
We get two different slopes: and .
Since there are two different slopes, there must be two different tangent lines.