Parametric equations: graphing a parametric curve in space
Download file: SurfaceGraph.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'plotly3D.pl', 'PGcourse.pl');
				Preamble
The macro plotly3D.pl is used to produce the graph.
$graph = Graph3D(
    height => 300,
    width  => 300,
    title  => 'Sphere',
);
$graph->addSurface(
    [ '3*sin(v)*cos(u)', '3*sin(v)*sin(u)', '3*cos(v)' ],
    [ 0,                 2 * pi,            30 ],
    [ 0,                 pi,                30 ]
);
				Setup
A plotly3D graph is created with the Graph3D function. There are many option (see the POD), but to get started include the height and width.
A parametric surface is added to the graph with the addSurface method, which takes 3 array refs, each of length 3. 1. These are strings as javascript function in the variables u and v. 2. The parametric range in u or [umin, umax, samples]. 3. The parametric range in v or [vmin, vmax, samples].
BEGIN_PGML [@ $graph->Print @]* END_PGML ENDDOCUMENT();
Statement
This just prints the graph. No question is asked.