MaplePortal/PlottingParametricCurves - Help

Home : Support : Online Help : MaplePortal/PlottingParametricCurves

Plotting Curves Defined Parametrically

 Introduction If the vector representation of a curve is considered to be a parametric representation, then (in Maple) there are at least three ways to graph a curve defined parametrically. A purely parametric representation (not using vectors) in 2-D is graphed using the plot command, and in 3-D using the spacecurve command. A vector representation in 2-D is graphed with the SpaceCurve, or PlotPositionVector commands (all in the VectorCalculus packages); in 3-D, with the spacecurve and the VectorCalculus commands. An integral curve of a vector field can be drawn with the FlowLine command in the $\mathrm{Student}\left[\mathrm{VectorCalculus}\right]$ package.  You can compare the options for graphing curves given parametrically in two or three dimensions.
 Initializations $\mathrm{restart};\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{with}\left(\mathrm{plots}\right):\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{with}\left(\mathrm{DEtools}\right):\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{with}\left(\mathrm{VectorCalculus}\right):\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{BasisFormat}\left(\mathrm{false}\right):$

The plot and spacecurve Commands

Figure 1 uses the plot command to graph the parametric curves $x=\mathrm{cos}\left(t\right),y=\mathrm{sin}\left(t\right)$.

Figure 1   Parametric plot in 2-D



The syntax for the plot command is a list of the form $\left[x\left(t\right),y\left(t\right),t=a..b\right]$, where, of course, $t$ can be any parameter. The list must have these three elements, and the range must be inside the list.



Figure 2 uses the spacecurve command to graph one loop of the helix $x=\mathrm{cos}\left(t\right),y=\mathrm{sin}\left(t\right),z=t$.

Figure 2   Parametric plot of a helix in 3-D

The syntax for the spacecurve command is flexible. The list $\left[x\left(t\right),y\left(t\right),z\left(t\right)\right]$ may or may not include the range; the list of three functions can even be a vector!

The VectorCalculus Commands

The original implementation of the VectorCalculus packages was based on the constructs of the free vector and the VectorField. In Cartesian coordinates, the point $\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)$ is identified with the "free" vector $⟨{x}_{1},{x}_{2},\dots ,{x}_{n}⟩$ whose tail is at the origin and whose head is at the point. This works fine in Cartesian coordinates where the basis vectors are constant. (It does not work well in non-Cartesian coordinates where the basis vectors change from point to point.)

Figure 3 uses the SpaceCurve command to plot the (Cartesian) free vector



$V≔⟨\mathrm{cos}\left(t\right),\mathrm{sin}\left(t\right)⟩$

 ${V}{≔}\left[\begin{array}{c}{\mathrm{cos}}\left({t}\right)\\ {\mathrm{sin}}\left({t}\right)\end{array}\right]$ (4.1)

Figure 3   2-D curve defined parametrically by a free vector, graphed with the SpaceCurve command



The SpaceCurve command could equally well have been applied to the free vector $⟨\mathrm{cos}\left(t\right),\mathrm{sin}\left(t\right),t⟩$, thereby producing the graph of a helix. Thus, the distinction between dimensions has been eliminated.



Updates to the VectorCalculus packages introduced the construct of the PositionVector  for defining curves (and surfaces). The curve graphed in Figures 1 and 3 would be represented by



 ${R}{≔}\left[\begin{array}{c}{\mathrm{cos}}\left({t}\right)\\ {\mathrm{sin}}\left({t}\right)\end{array}\right]$ (4.2)

and would be graphed with the PlotPositionVector command as per Figure 4.



Figure 4  PositionVector graphed by PlotPositionVector command



An option to the PlotPositionVector command plots the arrows of a vector field, and other options provide for plotting the arrows of the tangent, principal normal, and derivative fields for the position vector. This is illustrated in Figure 5 where tangent vectors are shown in black, and normal vectors are shown in green.





Figure 5   Drawing tangent and principal normal vectors with the PlotPositionVector command



The VectorField command defines a vector at each point of ${\mathrm{ℝ}}^{n}$. Figure 6 superimposes ten vectors of the vector field



 ${F}{≔}\left[\begin{array}{c}{{x}}^{{2}}{+}{y}\\ {x}{-}{y}\end{array}\right]$ (4.3)

on the curve R in Figure 4.

Figure 6   Arrows of the vector field F evaluated along the curve R



The integral of a vector field produces curves called flow lines along which the vectors of the field are tangent. (For example, the flow lines of an electric field are called field lines.) The FlowLine command in the $\mathrm{Student}\left[\mathrm{VectorCalculus}\right]$ package will draw the flow line emanating from a given point, as illustrated for the field F and Figure 7.



$\mathrm{Student}\left[\mathrm{VectorCalculus}\right]:-\mathrm{FlowLine}\left(F,⟨-3,3⟩,\mathrm{fieldoptions}=\left[\mathrm{grid}=\left[10,10\right],\mathrm{arrows}=\mathrm{medium},\mathrm{fieldstrength}=\mathrm{fixed}\right]\right)$

Figure 7   The flow line emanating from $\left(1,1\right)$ for the field F



It is not possible to ask the FlowLine command for more than one flow line. The alternative is to write the differential equations



 ${\mathrm{DEy}}{≔}\stackrel{{\mathbf{.}}}{{y}}\left({t}\right){=}{x}\left({t}\right){-}{y}\left({t}\right)$ (4.4)

and to integrate them with the DEplot command from the DEtools package. The result for the initial points



$\mathrm{inits}≔\left[\mathrm{seq}\left(\left[0,1,k\right],k=-4..4\right)\right]$

 ${\mathrm{inits}}{≔}\left[\left[{0}{,}{1}{,}{-4}\right]{,}\left[{0}{,}{1}{,}{-3}\right]{,}\left[{0}{,}{1}{,}{-2}\right]{,}\left[{0}{,}{1}{,}{-1}\right]{,}\left[{0}{,}{1}{,}{0}\right]{,}\left[{0}{,}{1}{,}{1}\right]{,}\left[{0}{,}{1}{,}{2}\right]{,}\left[{0}{,}{1}{,}{3}\right]{,}\left[{0}{,}{1}{,}{4}\right]\right]$ (4.5)

appears in Figure 8.



Figure 8   Integration of the field F by means of the DEplot command



Maple provides a task template for interactively generating orbits in the phase plane of the autonomous system

$\stackrel{.}{x}\left(t\right)=f\left(x\left(t\right),y\left(t\right)\right)$

$\stackrel{.}{y}\left(t\right)=g\left(x\left(t\right),y\left(t\right)\right)$



To open the task, from the Tools>Tasks menu, select Browse, then Differential Equations>ODEs>Phase portrait - Autonomous Systems. Click on Insert Minimal Content to display insert the template into the worksheet.

 Phase Portraits for Autonomous Systems Plot Window   $\le x\le$,     $\le y\le$   Differential Equations   $\stackrel{.}{x}=F\left(x,y\right)$ = $\stackrel{.}{y}=G\left(x,y\right)$ =   Equilibrium (Critical) Points     Parameter        $\le t\le$                      

To use this task template, enter the information on the left and press Enter Data. Then, click on the plot and choose the Click and Drag Manipulator from the Plot menu or plotting toolbar ( ).

Clicking on a point in the phase plane generates the orbit through that point.

Since graphing the flow lines of a planar vector field is equivalent to drawing the phase portrait of this same autonomous system, there is also a related Vector Fields Task:

Tools>Tasks>Browse: Vector Calculus>Vector Fields>Integrate Planar Vector Field



 Integrate Planar Vector Field Plot Window                         $\le x\le$,     $\le y\le$   Vector Field Component 1: Component 2:   Coordinates System: Cartesianbipolarcardioidcassinianelliptichyperbolicinvcassinianlogarithmiclogcoshparabolicpolarrosetangent        Variables:   Path Parameter                    $\le$

This task template is inserted into the worksheet and used in the same way as shown for the previous template: enter information, click Enter Data, click on the graph and select the Click and Drag Manipulator, and then click the graph to draw the flow line through that point.

These task templates are based on the DEplot command from the DEtools package. The extra steps of converting the components of the vector field to the syntax of differential equations are hidden in the code behind the buttons.