# Why can't an annulus be mapped as a rectangle

The following code is used to map an annulus to a rectangle:

S6 = ImplicitRegion[0.1 <= x^2 + y^2 <= 1, {x, y}];
RegionPlot[S6]
DiscretizeRegion[S6, {{-2, 2}, {-2, 2}}]
r6 = TransformedRegion[S6, {(#1*#1 + #2*#2)^0.5, ArcTan[#2/#1]} &];
RegionQ[r6]
RegionPlot[r6, PlotRange -> {{-0.2, 1.55}, {-2, 2}},
PerformanceGoal -> "Quality"]

r = TransformedRegion[
Annulus[{0, 0}, {Sqrt[1/10], 1}], {(#1*#1 + #2*#2)^0.5,
ArcTan[#2/#1]} &];
RegionPlot[r, PlotRange -> {{-0.2, 1.55}, {-2, 2}},
PerformanceGoal -> "Quality"]


But the output is not a rectangle. It has obvious jagged edges:

What can I do to map an annulus to a complete rectangle?

• It does not resolve the problem, but you have to use the two-argument-version of ArcTan, so it should be ArcTan[#1, #2] instead of ArcTan[#2/#1]. For a comparison see Plot[{ ArcTan[#2/#1] & @@ {Cos[t], Sin[t]}, ArcTan @@ {Cos[t], Sin[t]} }, {t, -Pi, Pi}] Mar 19, 2020 at 7:07
• @HenrikSchumacher Thank you very much for your comment. In addition, I want to know why ArcTan[#2/#1] causes sawtooth. Mar 19, 2020 at 8:32
• ArcTan[#1, #2] hasn't removed the sawtooth. Just remove the PlotRange option and you'll know what I mean. Mar 22, 2020 at 6:31
• easy answer: these spaces are not homotopic ;-P Mar 22, 2020 at 16:38
• @AccidentalFourierTransform It is not a continuous mapping, it just slits the annulus and straightens it out. Mar 22, 2020 at 16:44

Fiddling around...not an answer, other than that some obvious attempts don't work.

Try two half annuluses (annuli?)

S7 = ImplicitRegion[(1/10 <= x^2 + y^2 <= 1 && (x >= 0 )), {x, y}];
S8 = ImplicitRegion[(1/10 <= x^2 + y^2 <= 1 && (x <= 0 )), {x, y}];

GraphicsGrid[{{RegionPlot[S8 ], RegionPlot[S7]}}]


Use ToPolarCoordinates[{x, y}] to do the transformation. Now here is a weird one...I have to run ToPolarCoordinates[{x, y}] at least once outside of the transformation call or it fails. Very odd.

ToPolarCoordinates[{x, y}]
r7 = TransformedRegion[S7, Evaluate@ToPolarCoordinates];
r8 = TransformedRegion[S8, Evaluate@ToPolarCoordinates];


The r7 region plots exactly right. The r8 region plots wrong and jagged.

rp7 = RegionPlot[r7, PlotRange -> {{-0.2, 1.55}, 3/2 {-π, π}},
PerformanceGoal -> "Quality",
GridLines -> {Automatic, π (Range[9] - 5)/4},
FrameTicks -> {{π (Range[9] - 5)/4, None}, Automatic}
];

rp8 = RegionPlot[r8, PlotRange -> {{-0.2, 1.55}, 3/2 {-π, π}},
PerformanceGoal -> "Quality",
GridLines -> {Automatic, π (Range[9] - 5)/4},
FrameTicks -> {{π (Range[9] - 5)/4, None}, Automatic}
];

GraphicsGrid[{{rp7, rp8}}]


I could only get the r7 region to come out right using ToPolarCoordinates. It then gets the range of the angles right too. Didn't work with the hand-rolled transformation as in this question. The r8 region is wrong in the jagged edges and the angle range.

I tried this, but it crashes the kernel when you try to RegionPlot it.

S9 = ImplicitRegion[(1/10 <= x^2 + y^2 <= 1 && (x >= 0 || x <= 0)), {x, y}];


EDIT

Some more experimenting, things appear to work fine until you get x and y values in the lower left quadrant, both negative values. For example, this works fine.

S9 = ImplicitRegion[(1/10 <= x^2 + y^2 <= 1 && ((x >= 0) || (y >= 0))), {x, y}];
RegionPlot[S9]


ToPolarCoordinates[{x, y}]
r9 = TransformedRegion[S9, Evaluate@ToPolarCoordinates];

rp9 = RegionPlot[r9, PlotRange -> {{-0.2, 1.55}, 3/2 {-π, π}},
PerformanceGoal -> "Quality",
GridLines -> {Automatic, π (Range[9] - 5)/4},
FrameTicks -> {{π (Range[9] - 5)/4, None},Automatic}
]


• I'm getting crashes at random even in the original formulation, when running in my laptop 11.3. I sent it on to some others with more RegionPlot know-how. The crashes bother me more than the imperfect handling at the discontinuity, though I think that also could be nicer. Mar 22, 2020 at 17:07
• (+11) 千金市骨 :) Mar 29, 2020 at 12:44

One possible workaround is to add a thin gap on the annulus:

r = TransformedRegion[
Annulus[{0, 0}, {Sqrt[1/10], 1}, {-Pi + 0.001, Pi}],
{(#1^2 + #2^2)^0.5, ArcTan[#, #2]} &];

RegionPlot[r, AspectRatio -> Automatic]