Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Math 242
Views: 2430
This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is Creative Commons License
licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Prerequisites:

  • Intro to Sage

  • Graphing and Solving Equations

  • Tangent Lines

Parametric Equations

Suppose xx and yy are both functions of a variable tt, called the "parameter." Then each value of tt gives a point in the x-y plane, (x(t),y(t))(x(t),y(t)). The set of all such points as tt 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 yy is not a function of xx (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 tt starts at 00 and increases to π\pi.

%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 tt and plug them into the xx and yy 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 tt. Then define x(t)x(t) and y(t)y(t). Finally, type parametric_plot((x(t),y(t)),(t,0,pi)). Notice that (t,0,pi) controls which values of tt 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 aa and bb. If the curve looks incomplete, then increase tmax.

For example, try a=21, a=12, a=2a=21,\ a=\frac{1}{2},\ a=\sqrt{2} (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)))
Interact: please open in CoCalc

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 x(t)=2sin(2t)x(t)=2\sin(2t) and y(t)=2sin(t)y(t)=2\sin(t).

Although yy is not a function of xx, 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: dydt=dydxdxdt\displaystyle\frac{dy}{dt}=\frac{dy}{dx}\cdot\frac{dx}{dt}.

If dxdt0\displaystyle\frac{dx}{dt}\ne 0, then we can solve for dydx\displaystyle\frac{dy}{dx} to get dydx=dydtdxdt\frac{dy}{dx}=\frac{\frac{dy}{dt}}{\frac{dx}{dt}}

In other words, the slope of the curve in the x-y plane is given by ParseError: KaTeX parse error: Got group of unknown type: 'internal'.

Notice that this slope is given as a function of tt. So if we want the slope of the curve at a particular point (x,y)(x,y), then we need to find a value of tt that gives us this point.

Example 4

Find an equation for the tangent line to the curve above at t=π6t=\frac{\pi}{6}.

First, find the slope function. I'll call this function mm.

%var t x(t)=2*sin(2*t) y(t)=2*sin(t) m(t)=derivative(y,t)/derivative(x,t) show(m(t))
cos(t)2cos(2t)\displaystyle \frac{\cos\left(t\right)}{2 \, \cos\left(2 \, t\right)}

Now let's find the slope when t=π6t=\frac{\pi}{6}.

show(m(pi/6))
123\displaystyle \frac{1}{2} \, \sqrt{3}

Next, we calculate x(π6)x\left(\frac{\pi}{6}\right) and y(π6)y\left(\frac{\pi}{6}\right), then we use the point-slope form of a line: y=y1+m(xx1)y=y_1+m(x-x_1)

x(pi/6) y(pi/6)
sqrt(3) 1

Notice that the tangent line is a function of xx, not tt. In order to not interfere with our parametric function x(t)x(t), I will use capital XX 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')
123(X3)+1\displaystyle \frac{1}{2} \, \sqrt{3} {\left(X - \sqrt{3}\right)} + 1

Intersection Points

What happens to the derivative when the curve crosses itself?

Example 5

In the curve above, the curve intersects itself at (0,0)(0,0).

What values of tt result in (x(t),y(t))=(0,0)(x(t),y(t))=(0,0)?

We need a value of tt that gives both x(t)=0x(t)=0 and y(t)=0y(t)=0.

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 t=0t=0 will work. Is that the only possiblity?

No, we know there are more solutions, since xx and yy 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, x(t)=0x(t)=0 when t=zπ2t=\frac{z\pi}{2} for any integer zz, i.e., t=0, ±π2, ±2π2=±π, ±3π2, ±4π2=±2π,t=0,\ \pm\frac{\pi}{2},\ \pm\frac{2\pi}{2}=\pm\pi,\ \pm\frac{3\pi}{2},\ \pm\frac{4\pi}{2}=\pm 2\pi, etc.

On the other hand, y(t)=0y(t)=0 when t=zπt=z\pi for any integer zz, i.e. t=0, ±π, ±2π, ±3π,t=0,\ \pm\pi,\ \pm 2\pi,\ \pm3\pi, etc.

The values of tt on both of these lists result in both xx and yy being 00.

Look at the two lists, and see what they have in common. In this case, both lists have t=zπt=z\pi.

What is the slope of the curve when t=zπt=z\pi? Let's try a few values of zz.

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: 12\frac{1}{2} and 12-\frac{1}{2}.

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