Shared16 - Parametric Equations Assignment / Parametric Equations Notes.sagewsOpen in CoCalc
This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

### 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.

%var t
x(t)=sqrt(3)*cos(2*t)-cos(10*t)*sin(20*t)
y(t)=-sqrt(2)*sin(2*t)-sin(10*t)*sin(20*t)
parametric_plot((x(t),y(t)),(t,0,pi))


Below is an animation which shows the above curve being drawn as starts at and increases to .

%var t
x(t)=sqrt(3)*cos(2*t)-cos(10*t)*sin(20*t)
y(t)=-sqrt(2)*sin(2*t)-sin(10*t)*sin(20*t)
p=point((sqrt(3),0),xmin=-2.5,xmax=2.5,ymin=-2.5,ymax=2.5)
s=[p]
for n in [1..50]:
p+=parametric_plot((x(t),y(t)),(t,(n-1)*pi/50,n*pi/50))
s+=[p]
a=animate(s,figsize=5)
show(a,delay=20)


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).

@interact
def _(a=5,b=2,tmax=10*pi):
%var t
x(t)=(a-b)*cos(t)+b*cos((a-b)/b*t)
y(t)=(a-b)*sin(t)-b*sin((a-b)/b*t)
show(parametric_plot((x(t),y(t)),(t,0,tmax)))


## 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?

%var t
x(t)=2*sin(2*t)
y(t)=2*sin(t)
parametric_plot((x(t),y(t)),(t,0,2*pi))


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 .

%var t
x(t)=2*sin(2*t)
y(t)=2*sin(t)
m(t)=derivative(y,t)/derivative(x,t)
show(m(t))


Now let's find the slope when .

show(m(pi/6))


Next, we calculate and , then we use the point-slope form of a line:

x(pi/6)
y(pi/6)

sqrt(3) 1

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.

TL(X)=1+sqrt(3)/2*(X-sqrt(3))  #Note the capital X
show(TL(X))
parametric_plot((x(t),y(t)),(t,0,2*pi))+plot(TL(X),xmin=-2,xmax=3,color='red')+point((sqrt(3),1),size=25,color='black')


## 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.

%var t
x(t)=2*sin(2*t)
y(t)=2*sin(t)
solve(x(t)==0,t)
solve(y(t)==0,t)

[t == 0] [t == 0]

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).

solve(x(t)==0,t,to_poly_solve='force')
solve(y(t)==0,t,to_poly_solve='force')

[t == 1/2*pi*z45] [t == pi*z50]

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 .

m(-2*pi); m(-1*pi); m(0*pi); m(1*pi); m(2*pi)

1/2 -1/2 1/2 -1/2 1/2

We get two different slopes: and .

Since there are two different slopes, there must be two different tangent lines.

TL1(X)=0+1/2*(X-0)  #Note the capital X
TL2(X)=0-1/2*(X-0)  #Again, capital X
parametric_plot((x(t),y(t)),(t,0,2*pi))+plot(TL1(X),xmin=-3,xmax=3,color='red')+plot(TL2(X),xmin=-3,xmax=3,color='red')+point((0,0),size=25,color='black')