plot (parametric and polar plotting)

The
plot command can be used for many things besides plotting graphs of functions. This section describes two of them. Both of these produce plots of curves in the plane, but the curves can be more general than plots of functions. They are plots of parametrically-defined curves (i.e., each of x and y is given as a function of a third variable -- the parameter) and polar plots -- where the polar coordinate r is given as a function of the polar angle theta.

PARAMETRIC PLOTTING 
We begin with parametric plots. We will use the letter t for the parameter, but any variable name is permissible (as long as it has not been previously given a value). A parametric curve is specified by giving x and y as functions of t. In Maple, three pieces of information are needed:
            (i) the expression which specifies x as a function of the parameter
           (ii) the expression which specifies y as a function of the parameter
          (iii) the range over which the parameter is to vary.

For example, to plot the unit circle, we can specify x=cos(t) and y=sin(t) as t ranges from 0 to
2*Pi. In Maple, these three pieces of information are organized as follows (the square brackets are obligatory ):
                   [cos(t), sin(t), t=0..2*Pi]
So to get a plot of the circle, we use the statement:

>   restart:

>   plot([cos(t),sin(t),t=0..2*Pi],scaling=CONSTRAINED);

[Maple Plot]

The scaling=CONSTRAINED option in the plot statement tells Maple to use the same scale on the x and y axes -- otherwise the circle would look like an ellipse.

Notice that parametric plotting changes the "what" in the standard

plot(what,how);

syntax. "What" now is a parametric expression (or possibly a set of them, enclosed in braces -- you must be careful to keep the grouping symbols straight!), and "how" is used only for special options such as scaling, or colors or titles (see the Maple help on plot options for all the variations that can go here).

Here is an example with two curves plotted on the same axes (and a title):

>   plot({[t^2,t^3,t=-2..2],[t*cos(t),t*sin(t),t=0..10]}, title=`Two parametric curves`);

[Maple Plot]

In this example, even though the options were not specified in the statement, "boxed" axes and "constrained" scaling were chosen from the command bar once the plot window was clicked on. Can you tell which curve is which?

POLAR PLOTTING
To plot the polar coordinate (radius) r as a function of the polar angle (usually called theta, but any variable name can be used), the option
coords=polar must be specified in the "How" part of the plot command. In the "what" part, the same syntax as parametric equations is used -- except the name of the angle variable is the second function specified between the brackets. In polar coordinates, the equation r=1+cos(theta) is a cardioid (we will use "th" instead of "theta"):

>   plot([1+cos(th),th,th=0..2*Pi],coords=polar);

[Maple Plot]

Errors: The kinds of errors that can happen in parametric and polar plotting are the same as those that occur in regular plotting. See the section on basic plotting for more details.