Parametric CurvesWorksheet by \302\251Mike May, S.J., 2006- maymk@slu.edurestart:with(plots):This worksheet deals with plotting curves parametrically.Parametric curves in 2 dimensions:Graphs of functions as parametric curvesWe start with the easiest 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 that 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.Plotting inverses without finding the inverse functionA 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 where we have already seen such curves 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. Fading between two graphs, parameterizing a line between pointsA second use of parameterization is to fade from one image to another. The parameterization V(t) = 1*P0 + (1-t)*P0has value P0 when t=0 and P1 when t=1.This was the method used to graph the sides of the regions in the integration for triple integrals worksheet.P0 := <1,3>;
P1 := <4,9>;
plot([t*P0[1]+(1-t)*P1[1],t*P0[2]+(1-t)*P1[2], t=0..1]);Exercises:1) Plot the graph of y=sin(x) as a parametric curve.2) Modify your answer to # 1 so that you also include the graph of the inverse relation, x=sin(y).3) Plot a line segment from (3,-2) to (-2,2).4) Plot a square with vertices at (\302\2611, \302\2611). (You probably want to do this by plotting a set of four curves that are the sides of the square.)LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnCombined motions in 2 dimensions:One of the advantages of parametric descriptions 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 collisionsThe first example deals with the difference between collisions and overlapping paths.Suppose we have one particle on the Lissajous curve x=sin(3t), y=sin(5t), and a second particle on the circle parameterized by x=cos(t), y=sin(t). We can ask if the paths cross. That is answered by looking at the two curves in parametric form. We 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.SpirographsThe 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 incredibly 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 NiMlJnRoZXRhRw== 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 NiM3JCIiISomIiInIiIiJSNQaUdGJw==. The angle on the small circle moves at 19/3 the rate of the 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 move the pen inside the circle.Simplified planetary motionThe third example is planetary motion. If an observer tracks a planet against the background of the stars, the impression is that the planet occasionally 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 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 orbits of 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 appear 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.Exercises:5) An amusement park ride is designed with four big legs of length 25 revolving around the center every 10 seconds. At the end of each leg are four cars arranged in a circle of radius 8 revolving 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?LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnCurves in 3 dimensions:SpacecurveIn 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.An obvious first curve to draw with spacecurve is the helix.spacecurve([sin(t),cos(t),t],t=0..6*Pi, axes=normal, color=red);Using 3 dimensions to visualize parametric curvesOne obvious use of spacecurve 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 see the path traced out. If we look down the y-axis, we see the motion 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);Exercises:8) Plot the path on a unit sphere that goes from the north pole to the south pole while making four east-west rotations.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 NiMlJHBoaUc= and NiMlJnRoZXRhRw== settings) that give each view. 10) 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).11) 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).Plotting curves and surfaces together.A final use of spacecurve plotting is when we want to plot a curve and a surface together. For that we 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, style=patch, color=red):
path := spacecurve([1+t, 2+t, -3-2*t], t=-2..2):
display3d({path, sphere});From the picture, it is clear that the line does intersect the sphere.