5
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$
    – user64494
    Commented Feb 11, 2022 at 12:57
  • 3
    $\begingroup$ 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] $\endgroup$
    – Akku14
    Commented Feb 11, 2022 at 13:02

1 Answer 1

2
$\begingroup$

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}
]

enter image description here

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]

enter image description here

$\endgroup$
1
  • $\begingroup$ 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? $\endgroup$
    – user64494
    Commented Feb 11, 2022 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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