Plots in polar coordinates

EXPLOOT project

Ivan Cnop
Vrije universiteit Brussel
icnop@vub.ac.be

Warning

Never do this!

Clear[f];
f(r_, t_) := (r^2) cos(t) sin(t)

Plot3D[
      f(r, t), {r, 0, 2}, {t, 0, 2 π}]

Always use ParametricPlot3D:

and add mouse manipulation by

<< RealTime3D`

ParametricPlot3D[{r cos(t), r sin(t), 
        f(r, t)}, {r, 0, 2}, {t, 0, 2 π}]

The cartesian case

If  f   is given in terms of  x   and   y   we need a substitution:

Clear[f];

polar(r_, t_) := 
      f(x, y) /. {x -> r cos(t), 
          y -> r sin(t)}

f(x_, y_) := -(x/(Sqrt[(x^2) + (y^2)]))

Division by zero  takes place at the origin. Avoid thsi by starting fro a small positieve value of   r  :

ParametricPlot3D[{r cos(t), r sin(t), 
        polar(r, t)}, {r, 0.01, 2}, {t, 0, 2 π}]

The narrow split coincides with its discontinuity

Other example

Clear[f];

f(x_, y_) := 2 (( x y)/((x^2) + (y^2)))

ParametricPlot3D[{r cos(t), r sin(t), 
        polar(r, t)}, {r, 0.01, 2}, {t, 0, 2 π}, 
      PlotPoints -> {15, 30}]

Other example

Clear[f];

polar(r_, t_) := 
      f(x, y) /. {x -> r cos(t), 
          y -> r sin(t)}

f(x_, y_) := ((x^4)/((x^4) + (y^2)))

ParametricPlot3D[{r cos(t), r sin(t), 
        polar(r, t)}, {r, 0.0001, 2}, {t, 0, 2 π}, 
      PlotPoints -> {25, 50}]

The role of contourplot

ContourPlot does not give good results for this function, and zooming in around the origin doesn't help either:

Do[ContourPlot[
        ((x^4)/((x^4) + (y^2))), {x, - (2^(-j)),  
          (2^(-j))}, {y, - (2^(-j)),  (2^(-j))}, 
        PlotPoints -> 50], {j, 0, 3}]

We can however make a contourplot with different mesh sizes around the origin:

Show[
      Table[DensityPlot[
          ((x^4)/((x^4) + (y^2))), {x, - (2^(-j)),  
            (2^(-j))}, {y, - (2^(-j)),  (2^(-j))}, 
          PlotPoints -> 50], {j, 0, 3}]]

This is what we wanted to see.