# Artifact in conformal mapping using ParametricPlot

Bug introduced in 11.2 or earlier and persisting through 12.2

I'm trying to visualize a simple conformal map using ParametricPlot.

    ParametricPlot[
Through[{Re,Im}[1/(Exp[u+v I]+1)]],
{u,-5,5},{v, 0, 2Pi},
PlotRange->{{-2,2},{-2,2}},
Mesh->{100,Round[100 2Pi/10]},Axes->False,ImageSize->Large,
]


The result I get has a big white 'tear' down the middle. As far as I can tell, this artifact is shaped as if it is a white region between two kissing large-radius circles. But I can't tell whether it's a limitation/bug in ParametricPlot or an abuse of ParametricPlot or something I'm not seeing in the math. What's going on? I've noticed that when I remove the constant term in the denominator the problem goes away.

I'm using the cloud based Wolfram Development Platform. When I use ParametricPlot3D for this, I don't get an artifact. Neither do I get an artifact if I just trace the individual grid lines.

Update: We can demonstrate similar problems by using the simpler complex function 1/z. E.g.

ParametricPlot[
ReIm[1/(u+v I)],
{u,-5,5},{v, -5, 5},
PlotRange->{{-2,2},{-2,2}},
Mesh->100,Axes->False,ImageSize->Large,
]


or the equivalent

ParametricPlot[
ReIm[(u-v I)/(u^2+v^2)] ,
{u,-5,5},{v, -5, 5},
PlotRange->{{-2,2},{-2,2}},
Mesh->100,Axes->False,ImageSize->Large,
]


The former exhibits the tearing artifact, the latter has problems with mesh coloring.

• You can try the option Exclusions -> None but I get something I can't explain, at least without putting in some work I don't have time for right now. – Michael E2 Jan 29 '18 at 4:08
• Also, what "old ParametricPlot3D method"? Reference or code? – Michael E2 Jan 29 '18 at 4:09
• Back in the day, before ParametricPlot could plot regions (as opposed to just curves), I would use ParametricPlot3D to plot a region (using 0 as the z coordinate, and VIewpoint->{0,0,Infinity}) – brainjam Jan 29 '18 at 4:54
• If someone knows more about the versions this affects, please update the bugs header (see the tag info for more). – Michael E2 Jan 30 '18 at 16:28

Update: A less kludgy workaround, which I thought I had already tried.

ParametricPlot[
Evaluate@ Simplify@ ComplexExpand@ Through[{Re, Im}[1/(Exp[u + v I] + 1)]],
{u, -5, 5}, {v, 0, 2 Pi},
PlotRange -> {{-2, 2}, {-2, 2}}, Mesh -> {100, Round[100 2 Pi/10]},
Axes -> False, ImageSize -> Large,
MeshShading -> {{Yellow, Orange}, {Pink, Red}}]


Numerically checking this function with the OP's at a few points throughout the domain show they evaluate to the same numbers. I think this must be a bug.

Original workaround:

Show[
ParametricPlot[
Evaluate@ComplexExpand@Through[{Re, Im}[1/(Exp[u + v I] + 1)]],
{u, -5, 5}, {v, Pi + 0.00001, 2 Pi},
PlotRange -> {{-2, 2}, {-2, 2}},
Mesh -> {100, Round[0.5 100 2 Pi/10]}, Axes -> False,
ImageSize -> Large, MeshShading -> {{Yellow, Orange}, {Pink, Red}},
BoundaryStyle -> None],
ParametricPlot[
Evaluate@ComplexExpand@Through[{Re, Im}[1/(Exp[u + v I] + 1)]],
{u, -5, 5}, {v, 0, Pi},
PlotRange -> {{-2, 2}, {-2, 2}},
Mesh -> {100, Round[0.5 100 2 Pi/10]}, Axes -> False,
ImageSize -> Large, MeshShading -> {{Yellow, Orange}, {Pink, Red}}]
]

• Do you think ParametricPlot has a bug? For now I'd probably rather retreat to ParametricPlot3D where I don't have to fight this. – brainjam Jan 29 '18 at 5:33
• Something like ParametricPlot3D[ { Re[1/(Exp[u + v I] + 1)], Im[1/(Exp[u + v I] + 1)], 0}, {u,-5,5},{v,0,2Pi}, PlotRange->{{-2,2},{-2,2},{-.05,.05}}, PlotPoints->{40,40},ViewPoint->{0,0,Infinity}, Mesh->{100,Round[100 2Pi/10]},BoundaryStyle->Automatic, ImageSize -> Large] – brainjam Jan 29 '18 at 5:34
• @brainjam I can't see any explanation except that it's a bug. You should report it to WRI support. – Michael E2 Jan 29 '18 at 12:40
• The bug has been reported and reproduced/acknowledged (very speedy response from WRI, I'm impressed to say). – brainjam Jan 30 '18 at 14:40
• @BobHanlon, thanks, I found that out from @J.M.'s answer. I got the Through[{Re,Im}][ ] construction from the Wolfram docs on conformal mapping. Now I use ReIm. – brainjam Jan 30 '18 at 21:17

Here is a workaround that hinges on the built-in LogisticSigmoid[] function:

ParametricPlot[ReIm[LogisticSigmoid[-u - I v]], {u, -5, 5}, {v, 0, 2 Pi},
PlotRange -> 2, Mesh -> {100, Round[100 2 Pi/10]}, Axes -> False,
ImageSize -> Large, MeshShading -> {{Yellow, Orange}, {Pink, Red}}]


That the behavior in the OP is a clear bug can be demonstrated by expanding out the LogisticSigmoid[] function:

ParametricPlot[ReIm[LogisticSigmoid[-u - I v]] // FunctionExpand // Evaluate,
{u, -5, 5}, {v, 0, 2 Pi}, PlotRange -> 2, Mesh -> {100, Round[100 2 Pi/10]},
Axes -> False, ImageSize -> Large,
MeshShading -> {{Yellow, Orange}, {Pink, Red}}]


and the erroneous plot in the OP is reproduced.

• For whatever reason when I run the first piece code I get this: i.stack.imgur.com/MoQbA.png – b3m2a1 Jan 30 '18 at 5:52
• What version and OS did you use? This seems to work for 11.2. – J. M.'s ennui Jan 30 '18 at 6:25
• Mac 10.13.2; Mathematica 11.2 – b3m2a1 Jan 30 '18 at 6:28
• For what it's worth, the function I gave is a simplified version of the functions I was working with, and only coincidentally equal to LogisticSigmoid[] (although I appreciate that it's used here not so much as a workaround than as a demonstration of a bug). I've now found that the bug occurs for functions as simple as 1/z (where z is complex). I have a feeling it has something to do with an expression that may have a divide by zero. Meanwhile, I'm happy to discover from this answer that there is ReIm function which can replace the Through[{Re,Im}[]] construction. – brainjam Jan 30 '18 at 14:35
• Nice to see you again! – Michael E2 Jan 30 '18 at 16:29