Parametric Curves
Worksheet by Mike May, S.J.- maymk@slu.edu
Section 16.1
> restart:
This section deals with plotting curves parametrically.
Parametric curves in 2 dimensions:
We start with the easiset parameterizations, those of functions. The easiest way to parameterize graphs of functions is with the x variable. We define a function, plot it the old fashioned way, then plot it twice more as a parametric curve.
> func := x-> x + sin(x^2); plot(func(x), x=0..10); plot([x, func(x), x=0..10]); plot([2*t, func(2*t), t=0..5]);
Notice the the graph is the same in all three plots. We are particularly interested to note that the same graph can be drawn with different parameterizations.
A reason of greater interest for parametric curves is plotting relations that are not functions. These curves can only be plotted parametrically.
The most familiar class of examples when we have already seen this is when we are trying to invert functions that are not one-to-one. (Recall, for example, that trig functions are not one-to-one, so when we defined inverse trig functions, we needed to restrict the domains.) To graph an inverse parametrically, we simply switch the roles of x and y.
> func := x -> sin(x) + sin(2*x); plot([x, func(x), x=-2*Pi..2*Pi]); plot([func(x), x, x=-2*Pi..2*Pi]); plot({[x, func(x), x=-2*Pi..2*Pi], [func(x), x, x=-2*Pi..2*Pi]});
Notice that we plotted more than one curve at the same time by plotting a set of parameterizations.
Exercises:
1) Use parametric description of curves to plot a figure 8. (This can be done as a variation on Lissajous figures.)
>
2) Plot a square with vertices at (1, 1). (You probably want to do this by plotting a set of 4 curves that are the sides of the box.)
3) Plot the curve described by the parametric function where x(t) is given by straight line segments connecting (0, -1), (1, 1), (2, -1), (3, 1), and (4, -1) and y(t) is given by straight line segments connecting (0, 1), (1, 1), (2, -1), (3, -1) and (4, 1).
4) Plot the curve described by the parametric function where x(t) is given by straight line segments connecting (0, 2), (2, 0), and (4, 2) and y(t) is given by straight line segments connecting (0, 0), (0.5, 1), (1.5, -1), (2.5, 1), (3.5, -1) and (4, 1).
Combined motions in 2 dimensions:
One of the advantages of parametric description of curves is that they are convenient for "combined motions." This lets us plot curves obtained by adding parametric motions. Three examples come to mind.
Overlapping paths and colitions
The first example deals with the difference between collison and overlapping path.
Suppose I have one particle on the Lissajous curve with x=sin(3t), y=sin(5t), and a second particle on the circle parameterized by x=cos(t), y=sin(t). I can ask if the paths cross. That is answered by looking at the two curves in parametric form. I can also ask if the particles collide. this is answered by looking at the path of the difference of the parameters.
> x1:= t->sin(3*t): y1:= t->sin(5*t): x2:= t->cos(t): y2:= t->sin(t): plot({[x1(t), y1(t), t=0..2*Pi], [x2(t), y2(t), t=0..2*Pi]}); plot([x1(t)-x2(t), y1(t)-y2(t), t=0..2*Pi]);
The first graph plots the two curves on the same plot. It makes it clear that the two paths overlap. The second graph plots the relative difference of the two paths. (It plots where the second particle is compared to the first particle.) Since the curve never touches the origin, it makes it clear that the two particles never collide.
Spirographs
The second example is a spirograph. A spirograph drawing is made by letting a small circle roll around on the inside of a big circle and tracing a point on the edge of the small circle. The pen is revolving around the center of the small circle, while the center of the small circle is revolving around the center of the big circle. (The radius of the small circle moves in a circle whose radius is the difference of the big and small radii.) Thus we are adding two circular motions together. This path would be increadibly complicated as a relation of x and y, but is straightforward as a parametric expression. Consider the curve obtained by moving a circle of radius 3 around a circle of radius 19. If is the angle on the big circle, we need to go around 3 times for the path to close, so we want to plot t over a range . The angle on the small circle moves at 19/3 the rate ofthe angle on the big circle.
> bigrad := 19: smallrad := 3: rat := bigrad/smallrad: smallpos:= 1: xpath1 := (bigrad-smallrad)*cos(t): ypath1 := (bigrad-smallrad)*sin(t): xpath2 := smallpos*smallrad*cos(t*rat): ypath2 := smallpos*smallrad*sin(t*rat): plot([xpath1 + xpath2, ypath1 + ypath2, t=0..smallrad*2*Pi]);
Interesting variations can be obtained by putting the pen inside or outside the edge of the small circle. This can be done by multiplying the effect of the small circle by a constant. In the example above, smallpos=1, which puts the pen at the edge of the small circle. greater values of smallpos would move it outside the circle, while smaller values of smallpos more the pen inside the circle.
Simplified planetary motion
The third example is planetary motion. If an observer tracks a planet against the background of the stars, the impression is that the planet occationally stops and backs up for a while. Instead of adding two motions like we did with the spirograph, we subtract instead.
If we simplify the orbits to circles we can consider the relative motion of Mars from the Earth. For simplicity we assume that the radius of Mars' orbit is 3/2 that of Earth. The period of orbiting bodies increases with the (3/2) power of the radius of orbit. We want to plot the difference of the two positions to get the view from Earth. I am starting with both planets on the same side of the sun. We will plot for two years measured by the slower planet.
> rad2 := 3/2: year2 := rad2^(3/2): timemax := 2*max(1, year2): xpath1 := rad2*cos(t/year2): ypath1 := rad2*sin(t/year2): xpath2 := cos(t): ypath2 := sin(t): plot([xpath1 - xpath2, ypath1 - ypath2, t=0..timemax*2*Pi]);
It is clear that the planets would seem to start and stop. From Earth's point of view, Mars is going backwards whenever the planets line up on the same side of the sun.
5) An amusement park ride is designed with 4 big legs of length 25 revolving around the center every 10 seconds. At the end of ech leg are 4 cars arranged in a circle of radius 8 revloving every 2 seconds. The passengers in each car revolve in a circle of radius 2 feet around the center of the car every 1/3 second. Sketch the path of a passenger.
6) If the big circle of a spirograph has radius 10, and the small circle has radius 3, where should the pen be placed for the path to have sharp corners on the inside? To have loops on the inside?
7) If the big circle of a spirograph has radius A and the small circle has radius B, how many times does the small circle have to revolve for the path to close?
Curves in 3 dimensions:
In contrast to the 2 dimensional case, the only way we know to draw smooth curves in 3-dimensions is by defining the curve parametrically. (Recall that a line in 3-space is defined by a pair of equations. To plot curves in 3 dimensions, we use the spacecurve command in the plots package.
> with(plots);
Warning, the name changecoords has been redefined
The obvious first curve to draw with spacecurve is the helix.
> spacecurve([sin(t),cos(t),t],t=0..6*Pi, axes=normal, color=red, numpoints=100);
One obvious use of spacescurve plotting is to get a better understanding of the motion of a parametric curve. The third variable can be thought of as time. If we look down the z-axis, we se the path traced out. If we look down the y-axis, we see the action with respect to x. Similarly, looking down the x-axis gives the y-motion.
> spacecurve([sin(3*t),cos(5*t),t],t=0..2*Pi, axes=normal, color=red, numpoints=100);
A second use of spacecurve plotting is when se want to plot a curve and a surface together to see if they intersect. For that we will need the display3d command from the plots package.
Consider the question that asks if a line from [-1, 0, 1] to [3, 4, -1] intersects a sphere of radius 1 at the origin.
> sphere := plot3d(1, phi =0..Pi, theta=0..2*Pi, coords=spherical, color=green, scaling=constrained): path := spacecurve([1+t, 2+t, -3-2*t], t=-2..-.5, thickness=3, color=red): display3d({path, sphere});
From the picture, it is clear that the line does intersect the sphere.
8) Sketch the path on a unit sphere that goes from the north pole to the south pole while making 4 east-west rotaions.
9) Describe the 3 views of the Lissajous curve with x=sin(3t), y=sin(5t) describing path, x-view, and y-view. Give the orientations (the and settings) that give each view.