8
$\begingroup$

How can I plot $\theta=\cos r$ in polar plane? Of course I know that it is different from $r=\cos \theta.$

$\endgroup$
  • $\begingroup$ does this work: PolarPlot[ArcCos[t], {t, -Pi, Pi}]? $\endgroup$ – Algohi Dec 4 '14 at 5:18
11
$\begingroup$
  • If you can transform it to a parametric form:

    ParametricPlot[
      Evaluate @ CoordinateTransform["Polar" -> "Cartesian", {r, Cos[r]}], 
      {r, 0, 50}
    ]
    

    enter image description here

  • And if you have to use implicit form:

    ContourPlot[
        Evaluate[
            TransformedField[
                "Polar" -> "Cartesian", θ == Cos[r], {r, θ} -> {x, y}
            ] 
        ]
      , {x, 0, 50}
      , {y, -50, 50}
      , PlotPoints -> 25
      , AspectRatio -> Automatic
      , Frame -> False, Axes -> True
     ]
    

    enter image description here

$\endgroup$
7
$\begingroup$

Does this work for you:

PolarPlot[{ArcCos[t], -ArcCos[t]}, {t, -1,1}]

enter image description here

Update: (Sjoerd C. de Vries comment)

For all r

r=(+/-)ArcCos[t]+2 n Pi

Taking few of r results:

Show[Table[
  PolarPlot[{ArcCos[t], -ArcCos[t]} + n 2 Pi, {t, -1, 1}, 
   PlotRange -> All], {n, -10, 10}]]

enter image description here

$\endgroup$
  • $\begingroup$ Let $\theta$ is arbitrary, How is the graph? $\endgroup$ – Nimbigli Dec 4 '14 at 5:45
  • $\begingroup$ I don't understand you. but in general for each theta you will find r using ArcCos[theta]. then {theta,r} will be a point in the plot. $\endgroup$ – Algohi Dec 4 '14 at 5:52
  • 2
    $\begingroup$ I suppose you should take into account that r is unrestricted, so you have to work with Mod 2 pi. $\endgroup$ – Sjoerd C. de Vries Dec 4 '14 at 7:28
  • $\begingroup$ Why is left side included? theta is Cos[r] so in <-1,1> interval, right? $\endgroup$ – Kuba Dec 4 '14 at 9:40
  • 1
    $\begingroup$ That's probably kind of academic discussion but there is Cos[r] and r is > 0, if you assume that r can be negative, then ok. $\endgroup$ – Kuba Dec 4 '14 at 9:54
4
$\begingroup$

Another possible solution is to

  1. ContourPlot the equation directly;

  2. Make the coordinate transform on the coordinates of points inside the resulting graphic.

I've wrapped these steps in a function:

ClearAll@implicitPlot
implicitPlot[eq_, range__, coordSys_, opt : OptionsPattern[ContourPlot]] := 
 Module[{coord}, 
  With[{plot = ContourPlot[eq, range, opt, PlotRange -> All], 
    trans = #[coord, #2] &[Function, 
       CoordinateTransform[coordSys -> "Cartesian", {coord[1], coord[2]}]] /. 
      coord[i_] :> Part[coord, i]}, 
   plot /. GraphicsComplex[coord_, rest_] :> 
     GraphicsComplex[trans[coord\[Transpose]]\[Transpose], rest]]]

implicitPlot[Cos@r == theta, {r, 0, 40}, {theta, -8 Pi, 8 Pi}, "Polar", 
 PlotPoints -> 100]

Mathematica graphics

The advantage of this approach is, it allows us to directly set domain of definition under the interested coordinate system.

$\endgroup$
3
$\begingroup$

for completeness this can be done with ContourPlot (solutions already given are faster and probably better quality)

ContourPlot[
 Cos[Norm[{x, y}]] - ArcTan[x, y] == 0, {x, 0, 100}, {y, -100, 100}, 
 PlotPoints -> 100]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.