Plotting Parametric Curves 

 

In this worksheet we will explore plotting curves in Maple. First, we cover standard plots of graphs. Then parametric plots in 2 and 3 dimensions. 

Maple Worksheet: parametric_curves.mw 
For the old parametric playground worksheet: parametric.mws
An interactive version of the old worksheet: parametric_improved.mw

 

Select "EditExecuteWorksheet" to display all plots. 

 

Let's clear memory and load the "plots" package.  

 

> restart;
with(plots):
 

 

The "plot" command allows us to create 2D plots of graphs of functions. It also allows us to plot parametric curves. 

 

Example: A plot of y = sin(x) where `and`(`<=`(0, x), `<=`(x, `+`(`*`(4, `*`(Pi))))).  In general, we use "x=a..b" to denote the domain "`and`(`<=`(a, x), `<=`(x, b))". 

 

> plot(sin(x),x=0..4*Pi);
 

Plot_2d
 

 

Some plot features can be accessed by right-clicking on the plot itself (or on a Mac "apple command+click"). These plot options (along with other options) can also be included in the plot command itself. Try "? plot,options" to open up the plot options help page and see what other options are available. 

 

> ? plot,options
 

 

For example, let's plot sine again, but this time we'll color it green, make the plot thicker, used boxed coordinate axes, and tell Maple not to rescale. 

 

> plot(sin(x),x=0..4*Pi,axes=boxed,color=green,thickness=5,scaling=constrained);
 

Plot_2d
 

 

We can also plot 2D curves using "implicitplot". This allows us to plot curves such at circles and ellipses (which are not graphs of functions -- they fail the vertical line test). 

 

Example: The circle of radius 2 centered at the origin. Notice that we must specify both horizontal and vertical ranges for the "implicitplot" command. Whereas, "plot" automatically determines the appropriate vertical range given a particular horizontal domain. 

 

> implicitplot(x^2+y^2=4,x=-2..2,y=-2..2);
 

Plot_2d
 

 

The "plot" command can also plot parametric curves. The syntax is 'plot([x(t),y(t),t=a..b]);" where x(t) and y(t) are the functions defining our curve (each choice of "t" yields a point "(x(t),y(t))" on the curve). "t=a..b" indicates that our parameter should stay in the interval `and`(`<=`(a, t), `<=`(t, b)). 

 

Example: An ellipse x(t) = `+`(`*`(3, `*`(cos(t))))1 and y(t) = `+`(`*`(2, `*`(sin(t))), 2) where `and`(`<=`(0, t), `<=`(t, `+`(`*`(2, `*`(Pi))))). This is the curve defined (implicitly) by `+`(`/`(`*`(`^`(`+`(x, `-`(1)), 2)), `*`(`^`(3, 2))), `/`(`*`(`^`(`+`(y, `-`(2)), 2)), `*`(`^`(2, 2)))) = 1. 

 

> plot([3*cos(t)+1,2*sin(t)+2,t=0..2*Pi],scaling=constrained);
 

Plot_2d
 

 

Example: Plotting a Smiley Face. Carefully choosing some ellipses and circular curves, we get a (piecewise) defined smiley face. Notice that the "plot" command is told that "discont=ture" (i.e. there are discontinuities -- please don't connect these pieces). 

 

> x := t -> piecewise(t<=1,12*cos(2*Pi*t),t<=2,8*cos(Pi*t),t<=3,-4+cos(2*Pi*(t-2)),4+cos(2*Pi*(t-3))):
'x(t)'=x(t);
y := t -> piecewise(t<=1,12*sin(2*Pi*t),t<=2,8*sin(Pi*t),t<=3,5+2*sin(2*Pi*(t-2)),5+2*sin(2*Pi*(t-3))):
'y(t)'=y(t);

plot([x(t),y(t),t=0..4],x=-12..12,y=-12..12,discont=true,axes=none);
 

 

 

x(t) = piecewise(`<=`(t, 1), `+`(`*`(12, `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t)))))))), `<=`(t, 2), `+`(`*`(8, `*`(cos(`*`(Pi, `*`(t)))))), `<=`(t, 3), `+`(`-`(4), cos(`+`(`*`(2, `*`(Pi, `*`(`+`(`-`(2), t)...
y(t) = piecewise(`<=`(t, 1), `+`(`*`(12, `*`(sin(`+`(`*`(2, `*`(Pi, `*`(t)))))))), `<=`(t, 2), `+`(`*`(8, `*`(sin(`*`(Pi, `*`(t)))))), `<=`(t, 3), `+`(5, `*`(2, `*`(sin(`+`(`*`(2, `*`(Pi, `*`(`+`(`-`(...
Plot_2d
 

 

The "animate" command allows us to show "how" the parametric curve is being drawn (we can treat the parameter more like a time coordinate).  

 

Note: After you have executed an "animate" command, a plot (usually blank) will eventually appear, but no animation! To activate the animation, click on the plot area with your mouse.  Then a little control panel (like a CD player's) should appear at the top of your window. To play the animation, click on the button with a triangle on it. 

 

> animate(plot,[[x(t),y(t),t=0..c],view=[-12..12,-12..12],frames=100,numpoints=100,axes=none,discont=true],c=0..4);
 

Plot_2d
 

 

Example: A polar coordinates graph for Valentine's Day. Submitted by Dwight Boddorf to the MAA's American Mathematical Monthly Volume 115 Number 2 (February 2008) page 113. 

 

               r = `^`(abs(tan(theta)), `/`(1, `*`(abs(tan(theta))))) where `and`(`<=`(0, theta), `<=`(theta, Pi)).   

 

               Using the plot option "coordinates=polar", we can produce a standard (polar) plot. Or by using the formulas: x = `*`(r, `*`(cos(theta))) and y = `*`(r, `*`(sin(theta))) and replacing r with the the above formula, we can produce a parametric plot. We'll do both. 

 

> ? plot,coords
 

> plot(abs(tan(theta))^(1/abs(tan(theta))),theta=0..Pi,coords=polar,axes=none,color=red,thickness=5);
 

Plot_2d
 

> plot([abs(tan(t))^(1/abs(tan(t)))*cos(t),abs(tan(t))^(1/abs(tan(t)))*sin(t),t=0..Pi],axes=none,color=red,thickness=5);
 

Plot_2d
 

 

Animated Parametric Curves 

Note: Many of these animations where originally taken from a fellow graduate student's worksheet: "Marilyn Daily's Parametric Playground". 

 

 

Example:  x = `+`(`*`(`^`(t, 2)), `-`(`*`(2, `*`(t))))  and y = `+`(t, 1) where `and`(`<=`(0, t), `<=`(t, 4)).  This gives us a parabola. 

 

> x := t -> t^2 - 2*t:
'x(t)' = x(t);

y := t -> t + 1:
'y(t)' = y(t);

animate([x(c*t), y(c*t), t=0..4], c=0..1, view=[-2..9, -2..6], numpoints=150, frames=64);
 

 

 

x(t) = `+`(`*`(`^`(t, 2)), `-`(`*`(2, `*`(t))))
y(t) = `+`(t, 1)
Plot_2d
 

 

Example:  x = cos(t) and y = sin(t) where `and`(`<=`(0, t), `<=`(t, `+`(`*`(2, `*`(Pi))))).  This gives us the unit circle. 

 

> animate([cos(c*t), sin(c*t), t=0..2*Pi], c=0..1, view=[-1.2..1.2, -1.2..1.2], scaling=constrained, numpoints=150, frames=64);
 

Plot_2d
 

 

Example:  x = `+`(a, cos(t)) and y = `+`(`*`(a, `*`(sin(t))), sin(t)) where `and`(`<=`(`+`(`-`(Pi)), t), `<=`(t, Pi))  and `and`(`<=`(-2, a), `<=`(a, 2)).    

 

This example is different from the others! For each choice of "a" we get a different curve. In this animation, each frame is a fully graphed parametric curve. What changes is the additional parameter "a", which moves from -2 to 2 (and back). So this is a 1-parameter collection of parametric curves. In fact, we could graph these curves altogether and get a parameterized surface! 

 

> animate([a+cos(t),a*sin(t)+sin(t),t=-Pi..Pi],a=-2..2,view=[-4..4,-4..4],numpoints=100,frames=100);
 

Plot_2d
 

 

Here we stack up all of the parametric curves next to each other (the red surface) and cut through with the (gray) plane a = 1.5. The curve where these two surfaces intersect is the parametric curve x = `+`(1.5, cos(t)) and y = `+`(`+`(`*`(1.5, `*`(sin(t)))), sin(t)) (i.e. the curve above when . 

 

> mySurface := plot3d([a+cos(t),a*sin(t)+sin(t),a],t=-Pi..Pi,a=-2..2,color=red):
myPlane := plot3d([x,y,1.25],x=0..4,y=-4..4,color=grey):
display(mySurface,myPlane,axes=boxed,orientation=[80,5,115],viewpoint=circleleft);
 

Plot_2d
 

 

Example:  A Lissajous curve: x = cos(`+`(`*`(5, `*`(t)))) and y = sin(`+`(`*`(4, `*`(t)))) where `and`(`<=`(0, t), `<=`(t, `+`(`*`(2, `*`(Pi))))). 

 

> x := t -> cos(5*t):
'x(t)' = x(t);

y := t -> sin(4*t):
'y(t)' = y(t);

animate([x(c*t),y(c*t),t=0..2*Pi], c=0..1, scaling=constrained, numpoints=150, frames=128);
 

 

 

x(t) = cos(`+`(`*`(5, `*`(t))))
y(t) = sin(`+`(`*`(4, `*`(t))))
Plot_2d
 

 

Example:  The Archimedes spiral: x = `*`(t, `*`(cos(t))) and y = `*`(t, `*`(sin(t))) where `and`(`<=`(0, t), `<=`(t, `+`(`*`(8, `*`(Pi))))). 

 

> x := t -> t * cos(t):
'x(t)' = x(t);

y := t -> t * sin(t):
'y(t)' = y(t);

animate([x(c*t), y(c*t), t=0..8*Pi], c=0..1, view=[-25..25,-25..25], scaling=constrained, numpoints=150, frames=64);
 

 

 

x(t) = `*`(t, `*`(cos(t)))
y(t) = `*`(t, `*`(sin(t)))
Plot_2d
 

 

Example:  x = `+`(t, `*`(3, `*`(sin(t)))) and y = cos(t) where `and`(`<=`(0, t), `<=`(t, 30)). This gives us a spring. 

 

> x := t -> t + 3*sin(t):
'x(t)' = x(t);

y := t -> cos(t):
'y(t)' = y(t);

animate([x(c*t), y(c*t), t=0..30], c=0..1, numpoints=150, frames=64);
 

 

 

x(t) = `+`(t, `*`(3, `*`(sin(t))))
y(t) = cos(t)
Plot_2d
 

 

Example: x = `+`(t, sin(`+`(`*`(2, `*`(t))))) and y = `+`(t, sin(`+`(`*`(3, `*`(t))))) where `and`(`<=`(0, t), `<=`(t, 20)). This gives us a "crazy string". 

 

> x := t -> t + sin(2*t):
'x(t)' = x(t);

y := t -> t + sin(3*t):
'y(t)' = y(t);

animate([x(c*t), y(c*t), t=0..20], c=0..1, numpoints=150, frames=64);
 

 

 

x(t) = `+`(t, sin(`+`(`*`(2, `*`(t)))))
y(t) = `+`(t, sin(`+`(`*`(3, `*`(t)))))
Plot_2d
 

 

Hypocycloids and Epicycloids 

 

A hypocycloid is a curve which is generated by the motion of a point on a circle that rolls inside another circle. Parametric equations of a hypocycloid are of the form  

x = `+`(`*`(`+`(a, `-`(b)), `*`(cos(t))), `*`(b, `*`(cos(`/`(`*`(`+`(a, `-`(b)), `*`(t)), `*`(b))))))  and y = `+`(`*`(`+`(a, `-`(b)), `*`(sin(t))), `-`(`*`(b, `*`(sin(`/`(`*`(`+`(a, `-`(b)), `*`(t)), `*`(b))))))) 

(Try to figure out why the equations look like this!) 

 

> x := t -> (a-b) * cos(t) + b * cos( ((a-b)/b) * t ):
'x(t)' = x(t);

y := t -> (a-b) * sin(t) - b * sin( ((a-b)/b) * t ):
'y(t)' = y(t);
 

 

x(t) = `+`(`*`(`+`(a, `-`(b)), `*`(cos(t))), `*`(b, `*`(cos(`/`(`*`(`+`(a, `-`(b)), `*`(t)), `*`(b))))))
y(t) = `+`(`*`(`+`(a, `-`(b)), `*`(sin(t))), `-`(`*`(b, `*`(sin(`/`(`*`(`+`(a, `-`(b)), `*`(t)), `*`(b))))))) (1)
 

 

Examples: The following are examples of hypercycloids. Note how the parameters a and b change the appearance greatly. 

 

> a := 11/10;
b := 1;

animate([x(c*t), y(c*t), t = 0..20*Pi], c = 0..1, scaling=constrained, numpoints=150, frames=64);
 

 

 

`/`(11, 10)
1
Plot_2d
 

> a := 7/2;
b := 1;

animate([x(c*t), y(c*t), t = 0..4*Pi], c = 0..1, scaling=constrained, numpoints=150, frames=64);
 

 

 

`/`(7, 2)
1
Plot_2d
 

> a := 1/4;
b := 1;

animate([x(c*t), y(c*t), t = 0..8*Pi], c = 0..1, scaling=constrained, numpoints=200, frames=64);
 

 

 

`/`(1, 4)
1
Plot_2d
 

 

 

An epicycloid is a curve which is generated by the motion of a point on a circle that rolls outside another circle. Parametric equations of an epicycloid are of the form 

x = `+`(`*`(`+`(a, b), `*`(cos(t))), `-`(`*`(b, `*`(cos(`/`(`*`(`+`(a, b), `*`(t)), `*`(b))))))) and y = `+`(`*`(`+`(a, b), `*`(sin(t))), `-`(`*`(b, `*`(sin(`/`(`*`(`+`(a, b), `*`(t)), `*`(b))))))) 

 

> # clear out parameters a & b.
a := 'a':  b := 'b':

x := t -> (a+b) * cos(t) - b * cos( ((a+b)/b) * t ):
'x(t)' = x(t);

y := t -> (a+b) * sin(t) - b * sin( ((a+b)/b) * t ):
'y(t)' = y(t);
 

 

x(t) = `+`(`*`(`+`(a, b), `*`(cos(t))), `-`(`*`(b, `*`(cos(`/`(`*`(`+`(a, b), `*`(t)), `*`(b)))))))
y(t) = `+`(`*`(`+`(a, b), `*`(sin(t))), `-`(`*`(b, `*`(sin(`/`(`*`(`+`(a, b), `*`(t)), `*`(b))))))) (2)
 

 

Examples: The following are examples of epicycloids. Note how the parameters a and b change the appearance greatly. 

 

> a := 10;
b := 1;

animate([x(c*t), y(c*t), t = 0..2*Pi], c = 0..1, scaling=constrained, numpoints=150, frames=64);
 

 

 

10
1
Plot_2d
 

> a := 7/5;
b := 1;

animate([x(c*t), y(c*t), t = 0..10*Pi], c = 0..1, scaling=constrained, numpoints=300, frames=64);
 

 

 

`/`(7, 5)
1
Plot_2d
 

 

Example: A Butterfly curve. 

 

> x := t -> sin(t)*(exp(cos(t))-2*cos(4*t)-sin((1/12)*t)^5):
'x(t)' = x(t);

y := t -> cos(t)*(exp(cos(t))-2*cos(4*t)-sin((1/12)*t)^5):
'y(t)' = y(t);


animate([x(c*t),y(c*t),t=0..8*Pi], c=0..1, numpoints=500, scaling=constrained, frames=100, axes=none);
 

 

 

x(t) = `*`(sin(t), `*`(`+`(exp(cos(t)), `-`(`*`(2, `*`(cos(`+`(`*`(4, `*`(t))))))), `-`(`*`(`^`(sin(`+`(`*`(`/`(1, 12), `*`(t)))), 5))))))
y(t) = `*`(cos(t), `*`(`+`(exp(cos(t)), `-`(`*`(2, `*`(cos(`+`(`*`(4, `*`(t))))))), `-`(`*`(`^`(sin(`+`(`*`(`/`(1, 12), `*`(t)))), 5))))))
Plot_2d
 

 

Curves in 3-Dimensional Space 

 

To graph parametric curves in 3-dimensional space, we use the "spacecurve" command.  

 

Example: Let's plot the twisted cubic r(t) = `<,>`(t, `*`(`^`(t, 2)), `*`(`^`(t, 3))) (that is x = t, y = `*`(`^`(t, 2)), and z = `*`(`^`(t, 3))) where `and`(`<=`(0, t), `<=`(t, 2)). 

 

> spacecurve([t,t^2,t^3],t=0..2,color=blue,axes=boxed,orientation=[70,75,0],viewpoint=circleleft);
 

Plot_2d
 

 

Example: Here is an elliptical helix. 

 

> spacecurve([cos(t),3*sin(t),t],t=0..6*Pi,scaling=constrained,color=blue,axes=boxed,viewpoint=circleleft);
 

Plot_2d
 

 

Example: y = `*`(`^`(x, 2)) and z = `*`(`^`(`+`(`*`(`^`(x, 2)), 1), `/`(3, 2))) where `and`(`<=`(-1, x), `<=`(x, 4)).  

 

To parameterize this curve we use x = t so then y = `*`(`^`(t, 2)) and z = `*`(`^`(`+`(`*`(`^`(t, 2)), 1), `/`(3, 2))) and `and`(`<=`(-1, t), `<=`(t, 4)). 

 

> r := t -> [t,t^2,(t^2+1)^(3/2)]:
'r(t)' = r(t);

spacecurve(r(t),t=-1..4,axes=boxed,color=blue,thickness=5,projection=0.5,orientation=[-154,75],title="The curve y=x^2 and z=(x^2+1)^(3/2)");
 

 

r(t) = [t, `*`(`^`(t, 2)), `*`(`^`(`+`(`*`(`^`(t, 2)), 1), `/`(3, 2)))]
Plot_2d