RegionPlot of an area inside a polar plot (or its equivalent parametric plot)

Let' s take a most simple example for a polar plot, the Archimede's spiral.

{p1, p2} =  MapThread[PolarPlot[t , {t, 0,8 Pi},
RegionFunction -> #1,PlotStyle -> #2 ] &,
{{( 2 Pi <= #3 <= 5 Pi/2 || 4 Pi <= #3 <= 9 Pi/2 &), (0 <= #3 < 2 Pi ||
5 Pi/2 < #3 < 4 Pi || #3 > 9 Pi/2 & )}, {Red, Blue}}];
Show[p1, p2]


How can I use here RegionPlot for the area between the two red arcs?
It takes two parameters as input and here there is only one to be given (by #3) and I could not find out a way to circumvent that.
As I want to practise with the new Region Properties and Measures MMA V10 functions, an answer using RegionPlot of region which can be reused for RegionMeasure (for example) is needed.

• I think ImplicitRegion[{2 Pi < Sqrt[x^2 + y^2] - ArcTan[x, y] < 4 Pi, x > 0, y > 0}, {x, y}] should give the region you want, but it doesn't seem to work. Dec 28 '14 at 16:53
• With reg=ParametricRegion[{r Cos[\[Theta]], r Sin[\[Theta]]}, {{\[Theta], 0, \[Pi]/2}, {r, 2 \[Pi] + \[Theta], 4 \[Pi] + \[Theta]}}]; some region properties seem to work, e.g. {RegionDimension[reg],RegionEmbeddingDimension[reg]} gives {2,2}. Could you try if it works for other region functions such as RegionMeasure[reg] or RegionMember[reg, {10,4}]?
– kglr
Dec 28 '14 at 17:25
• @SigismondKmiecik, for some questions it takes a while to get the attention of someone in the know.
– kglr
Jan 6 '15 at 21:04

As this question had been asked while I had a MMA 10.0 version and did not get an answer after many weeks I’ll provide my own borrowing from comments received then and new elements after my upgrade to subsequent versions of MMA.

The area I want to measure using the new MMA V10 functions for region properties and measures is the colored section of the ParametricPlot below

 parmplot = ParametricPlot[
r {Cos[t], Sin[t]}, {t, 0, Pi/2}, {r, 2 Pi + t, 4 Pi + t},
ColorFunction -> "RustTones"];
Show[ParametricPlot[t {Cos[t], Sin[t]}, {t, 0, 6 Pi}], parmplot]


I know what to expect as the right figure can be obtained with a double integral, probably available since the early MMA versions.

exactarea = Integrate[r, {\[Theta], 2 Pi, 5 Pi/2}, {r, \[Theta],\[Theta] + 2 Pi}] (* (13 \[Pi]^3)/4 *)


Parametric Coordinates

Using the ParametricPlot code as a template for the ParametricRegion code:

parmreg = ParametricRegion[{r Cos[t], r Sin[t]}, {{t, 0, \[Pi]/2},{r, 2 Pi + t, 4 Pi + t}}];
RegionQ[%] (* True *)
RegionMeasure[parmreg]   (* V 10.0 loop - had to abort *)
(* V 10.1 (13 \[Pi]^3)/4 OK *)


With MMA 10.0 I spent hours to understand where my mistake was (because I thought there was one) and find a bypass, eventually giving up. Lo and behold after my MMA upgrade, the same code runs now OK!

Let's go further:

DiscretizeRegion[parmreg]   (* V10.0 loop - had to abort *)
(* V10.1 loop - had to abort *)
(* V10.2 loop - had to abort *)


This time, I knew better, contacting Wolfram support which acknowledged there was a problem and forwarded to the development team.

                           (* V10.4  Corrected:RegionArea 100.77*)


Cartesian coordinates

Any parametric coordinates can be transformed into cartesian coordinates, here put into an ImplicitRegion expression:

cartreg = ImplicitRegion[2 \[Pi] < Sqrt[x^2 + y^2] - ArcTan[x, y] < 4 \[Pi] &&
0 <= x <= 15 && 0 <= y <= 15 , {x, y}];
RegionMeasure[cartreg] (* MMA V10.0 and V10.1 and V10.2 - error message: Unable to compute the measure of region...*)


No loop here as before but an error straight away. MMA currently cannot handle this. However the next steps were fruitful:

regiontoplot = DiscretizeRegion[cartreg, AccuracyGoal -> 5];
NumberForm[#, {8, 5}] & @Area[regiontoplot] (* 100.77034 OK *)
NumberForm[Integrate[1, {x, y} \[Element] regiontoplot ], {8, 5}] (* OK*)
% / exactarea (* 0.999999 *);
pt = RegionCentroid[regiontoplot] ;


And a final plot to visualize the answers above and to assure oneself of their correctness:

Show[ParametricPlot[t {Cos[t], Sin[t]}, {t, 0, 6 Pi}], regiontoplot,
Graphics[{PointSize[Large], Red, Point[pt]}]]
`

My conclusion is that at least for the new functions I was interested in and even afer two successive MMA versions they are still error prone which is most frustating.Is it reasonable to expect corrective updates in the near future?

• MMA 10.4 brought one improvement but problems remain Aug 1 '16 at 10:32