Application Center - Maplesoft

App Preview:

Classroom Tips and Techniques: A Note on Parametric Plotting

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application



Classroom Tips and Techniques: A Note on Parametric Plotting 


Robert J. Lopez 

Emeritus Professor of Mathematics and Maple Fellow 





Recently, I was asked how to draw a curve defined parametrically by the two equations , in the case where explicit solutions cannot be obtained. Of course, when such explicit functions can be written, Maple's plot command will suffice. This article describes two approaches for the case when remain defined implicitly. 


Method 1 


One approach to obtaining a point on the curve is to set , constant, in , and solve numerically for and . Of course, the devil is always in the details - for some functions manual intervention might be necessary to insure that Maple's fsolve command can find such a solution.  And drawing a graph requires multiple points to be found, so this numeric solving has to be iterated. 


Method 2 


Assuming that the equations , define a function for a suitable -interval, the identities 




can be differentiated with respect to to generate the ordinary differential equations 




Initial conditions at can be determined by solving , for . Then, Maple's dsolve command can be used to generate a numeric solution of the resulting initial value problem, and its odeplot command can be used to graph the resulting solution. The options provided in these two commands are robust enough to simplify the work of obtaining a graph based on numeric calculations. 







Example 1 


We begin with a simple example that has an explicit resolution. Let the curve be defined implicitly by the equations 





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


Of course, the first equation defines a circle with center at the origin and radius , while the second defines a line with slope that passes through the origin.  Figure 1 provides an animation of these two curves whose intersection defines the points on the curve given parametrically by





Figure 1   As varies, the intersection of the line and the circle defines the curve  


For an implicit representation of the curve Maple provides 



`+`(`-`(`*`(`^`(x, 4))), `-`(`*`(`^`(y, 2), `*`(`^`(x, 2)))), `*`(`^`(y, 2))) = 0


For an explicit parametric representation of this curve, Maple provides  



{x = `/`(`*`(t), `*`(`^`(`+`(1, `*`(`^`(t, 2))), `/`(1, 2)))), y = `/`(`*`(`^`(t, 2)), `*`(`^`(`+`(1, `*`(`^`(t, 2))), `/`(1, 2))))}, {x = `+`(`-`(`/`(`*`(t), `*`(`^`(`+`(1, `*`(`^`(t, 2))), `/`(1, 2)...


In Figure 2, a graph of one branch of this curve (in green) is added to the animation in Figure 1. 





Figure 2   One branch of drawn in green 


In Figure 2, the curve, defined parametrically (but explicitly), is graphed with the plot command, using the appropriate syntax for a parametric plot, namely, a list of the form


Example 2 


The equations 





sin(`*`(t, `*`(y))) = `+`(`-`(t))
`*`(`^`(t, 2)) = `/`(`*`(x, `*`(`+`(1, `-`(cos(`*`(t, `*`(y))))))), `*`(`+`(1, y)))


can be solved for explicitly, but they are the equations that accompanied the user's question. These explicit functions are given by 





`+`(`-`(`/`(`*`(arcsin(t)), `*`(t))))
`/`(`*`(t, `*`(`+`(`-`(t), arcsin(t)))), `*`(`+`(`-`(1), `*`(`^`(`+`(1, `-`(`*`(`^`(t, 2)))), `/`(1, 2))))))


from which Figure 3, a graph of the parametrically defined curve, can be drawn. 





Figure 3   Parametric curve drawn from the explicit  


A strictly numeric solution of this graphing problem requires iterating the numeric solution of the equations , for specific values of . Let's look at the requisite calculations for



{x = -0.3340031149e-2, y = -1.001674212}


Since we want to draw a graph, we need to put the solution into the form  



[-0.3340031149e-2, -1.001674212]


We can tediously repeat these calculations for additional values of , or we can execute them in the following loop. 




Once all the points have been computed, they are stored in the list . Figure 4 provides a graph of these points, along with a linear interpolant. To improve this graph, we would have to compute at more values of , but as approaches 1, the spacing between the computed points increases. The most efficient way to improve Figure 4 is to use a nonuniform grid, but that adds to the computational complexity. 




Figure 4   Numerically computed points for uniformly spaced values of  


Example 3 


Using the equations from Example 2, we next obtain the desired graph by solving a system of differential equations. To this end, write the equations with the parameter-dependence of and explicitly stated. 





sin(`*`(t, `*`(y(t)))) = `+`(`-`(t))
`*`(`^`(t, 2)) = `/`(`*`(x(t), `*`(`+`(1, `-`(cos(`*`(t, `*`(y(t)))))))), `*`(`+`(1, y(t))))


Then, differentiate both equations with respect to the parameter





`*`(cos(`*`(t, `*`(y(t)))), `*`(`+`(y(t), `*`(t, `*`(diff(y(t), t)))))) = -1
`+`(`*`(2, `*`(t))) = `+`(`/`(`*`(diff(x(t), t), `*`(`+`(1, `-`(cos(`*`(t, `*`(y(t)))))))), `*`(`+`(1, y(t)))), `/`(`*`(x(t), `*`(sin(`*`(t, `*`(y(t)))), `*`(`+`(y(t), `*`(t, `*`(diff(y(t), t))))))), ...
`+`(`*`(2, `*`(t))) = `+`(`/`(`*`(diff(x(t), t), `*`(`+`(1, `-`(cos(`*`(t, `*`(y(t)))))))), `*`(`+`(1, y(t)))), `/`(`*`(x(t), `*`(sin(`*`(t, `*`(y(t)))), `*`(`+`(y(t), `*`(t, `*`(diff(y(t), t))))))), ...


Determine initial conditions, typically at the starting value of the parameter. We use after experimenting with where the first equation reduces to . A numeric solution cannot be generated from this point, so we stepped ever so slightly away from this singularity. 





y(`/`(1, 10)) = `+`(`-`(`*`(10, `*`(arcsin(`/`(1, 10))))))
x(`/`(1, 10)) = `+`(`/`(`*`(`/`(1, 10), `*`(`+`(`-`(1), `*`(10, `*`(arcsin(`/`(1, 10))))))), `*`(`+`(`-`(10), `*`(3, `*`(`^`(11, `/`(1, 2))))))))


Figure 5 shows the result of plotting the numerically calculated solution of the differential equations representing the given system of algebraic equations. Refining the graph is much easier with the combination of the dsolve and odeplot commands. The range option in dsolve allows us to use the refine option in odeplot, thereby automatically increasing the number of points used in the plot. Setting causes odeplot to use all stored points for drawing the graph. 





Figure 5   Parametric plot obtained as a solution of a system of ODEs 



Legal Notice: ? Maplesoft, a division of Waterloo Maple Inc. 2010. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities