2D Polar plot



> How do I plot a 2d polar figure? For example r = 1 + 2 * cos(theta)

Here's a simple way.  Define the function plot_polar as follows:

plot_polar(expr,range) :=
    block([theta_var: range[1]],
      plot2d( ['parametric, 
               cos(theta_var)*expr,
               sin(theta_var)*expr,
               range]))$

To display a semi-circle:

  plot_polar(1,[t,0,%pi])$

Note that there is no guarantee of the same scale for x and y, so the
semi-circle appears squashed.

And a cardioid:

  plot_polar( 1 + 2 * cos(t), [t,0,2*%pi])

Unfortunately, there is a (bizarre) bug in version 5.9.0/Windows which
only allows single-character variable names in this case: you can't use
"theta".  Perhaps this has been fixed in a more recent version.

      -s