# ContourPlot plots an empty graph

I want to display the solution of the equation $$e^{2ix} = (x+i\sqrt{1-x^2}) e^{-iy},$$ where $$-1\leq x \leq 1$$ and $$0\leq y\leq 2\pi$$. I used the ContourPlot as follows:

ContourPlot[
Exp[2 I x] == (x + I Sqrt[1 - x^2])^2 Exp[-I y], {x, -1, 1}, {y, 0,
2 Pi}]


However, it plots an empty graph! How can I fix this problem?

• It should be noticed that ComplexContourPlot[ Exp[2 I Re[ z]] == (Re[z] + I Sqrt[1 - Re[z]^2])^2 Exp[-I Im[z]], {z, -1 + 0 I, 1 + 2 \[Pi] I}, PlotPoints -> 200] also produces an empty plot. Is this a bug? Commented Feb 11, 2022 at 12:57
• ContourPlot[{Re[Exp[2 I x] - (x + I Sqrt[1 - x^2])^2 Exp[-I y]] == 0, Im[Exp[2 I x] - (x + I Sqrt[1 - x^2])^2 Exp[-I y]] == 0}, {x, -1, 1}, {y, 0, 2 Pi}, ContourStyle -> {{Thickness[.02], Opacity[.5], Red}, {Thickness[.005], Black}}, PlotPoints -> 100] Commented Feb 11, 2022 at 13:02

It returns empty graph because the given contour/expression requires infinite precision to be drawn properly due to complex terms. When you try to plot that contour as given, there always will be some tiny imaginary term, which cannot be used in plotting.

You could think of drawing Re[f[x,y]]==0 and Im[f[x,y]]==0

f[x_, y_] := Exp[2*I*x] - (x + I*Sqrt[1 - x^2])^2*Exp[-I*y]
GraphicsRow[
ContourPlot[{#}, {x, -1, 1}, {y, 0, 2 Pi}, PlotPoints -> 100] &
/@ {Re[f[x, y]] == 0, Im[f[x, y]] == 0}
]


and trying to draw their intersection using

ConditionalExpression[Re[f[x, y]], Im[f[x, y]]==0] == 0


But this contour recurs another precision problem when plotting and returns empty graph. A workaround to this is introducing small r such that -r < Im[f[x,y]] < r:

r = 0.01;
ContourPlot[
ConditionalExpression[Re[f[x, y]], -r < Im[f[x, y]] < r] == 0
, {x, -1, 1}, {y, 0, 2 Pi}, PlotPoints -> 500]


• Why does ComplexContourPlot[ Exp[2 I Re[ z]] == (Re[z] + I Sqrt[1 - Re[z]^2])^2 Exp[-I Im[z]], {z, -1 + 0 I, 1 + 2 \[Pi] I}, PlotPoints -> 200] also produce an empty plot? Is this a bug? Commented Feb 11, 2022 at 14:13