Surface Graph in Cylindrical Coordinates

This shows an interactive graph in 3D in cylindrical coordinates.

Complete Code

Download file: CylindricalGraph3D.pg

POD for Macro Files

PG problem file

Explanation

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'plotly3D.pl', 'PGcourse.pl');

Preamble

The dynamic graph is generated with plotly3D.pl, so this is needed.

$a = random(2, 5);

$gr1 = Graph3D();
$gr1->addSurface(
    [ 'u*cos(v)', 'u*sin(v)', "$a*cos(u^2/4)" ],
    [ 0,          6,          30 ],
    [ 0,          2 * pi,     30 ]
);

$gr2 = Graph3D();
$gr2->addSurface(
    [ 'r*cos(t)', 'r*sin(t)', 'r*sin(t)^2' ],
    [ 0,          6,          30 ],
    [ 0,          2 * pi,     30 ],
    variables => [ 'r', 't' ]
);

Setup

We generate the plot parametrically for the radial functions z=cos(r^2/4) and z=r*sin^2(t).

This occurs with x=u*cos(v) and y=u*sin(v), where u and v are used as the radial and angular variables respectively. These are the default variables used.

The second plot changes the variables to r and t and shows a function with a non-rotational symmetric plot.

The addSurface is very flexible, but if you are plotting a function in cylindrical coordinates, then the first two functions should remain the same.

See plotly3D.pl for more information on options.

BEGIN_PGML
This just shows the two plots side by side.

[@ $gr1->Print @]* [@ $gr2->Print @]*
END_PGML

Statement

This shows how to add a plot to the problem.

BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.