# How can I draw a hyperbola of a complex form

How can I use Mathematica to draw locus of point in complex plane given by $||z-i|-|z+i||=1.$
I have tried few codes, but not succeed.

• Replace $z$ with $x+iy$ and use ContourPlot[]. Dec 10, 2015 at 7:06
• @J.M.: Aren't there any direct way to draw it? Dec 10, 2015 at 7:07
• Nothing built-in. So, try my suggestion and report back. Dec 10, 2015 at 7:36
• Thank you very much. Definitely I will report. Dec 10, 2015 at 9:47

f = Abs[z - I] - Abs[z + I] /. z :> x + I y;

Show[

DensityPlot[f, {x, -10, 10}, {y, -2 Pi, 2 Pi},
PlotPoints -> 60,
ColorFunction -> "DarkRainbow",
ImageSize -> 400],

ContourPlot[{f == 1, -f == 1}, {x, -10, 10}, {y, -2 Pi, 2 Pi},
ContourStyle -> Black,
ImageSize -> 400]]


Or

DensityPlot[f, {x, -10, 10}, {y, -2 Pi, 2 Pi},
PlotPoints -> 60,
ColorFunction -> "DarkRainbow",
ImageSize -> 400,
Mesh -> {{1}},
MeshFunctions -> (Function[{x, y}, #] & /@ {f, -f})]


This function finds the points that satisfy the complex equation and then plots it.

 complexPlot[complexEq_, range_, points_] := Module[{sol, data},

sol = FindInstance[complexEq && -range < Re[z] < range, z, points];
data = z /. sol;
ListPlot[(Tooltip[{Re[#1], Im[#1]}] &) /@ data, AspectRatio -> 1,
PlotRange -> Full, Frame -> True,
FrameLabel -> {{"y", None}, {"x", None}},
PlotLabel -> "Argand diagram"]
]


You can input your expression as it is in the complex form and specify the x range and number of data points.

f = Norm[Norm[z - I] - Norm[z + I]] == 1;
complexPlot[f, 10, 1000]


• I think this solution expends way more effort than this problem warrants. Dec 10, 2015 at 14:30
f = Abs[z - I] - Abs[z + I];


Using ComplexContourPlot (new in 12.1)

ComplexContourPlot[
{f == 1, -f == 1}, {z, -10 - 2 Pi I, 10 + 2 Pi I},
PlotLegends -> "Expressions",
Axes -> True]


ComplexContourPlot[
f, {z, -10 - 2 Pi I, 10 + 2 Pi I},
ColorFunction -> "DarkRainbow",
ContourLabels -> Function[{x, y, z},
Text[Framed[z], {x, y}, Background -> GrayLevel[0.8]]],
Axes -> False]


Using ComplexRegionPlot (new in 12.1)

ComplexRegionPlot[
{f < 1, -f < 1}, {z, -10 - 2 Pi I, 10 + 2 Pi I},
Axes -> True]


I appreciate that "doing the math" is not seen as an acceptable answer but is interpreted as using the language as "a typewriter", compared with just let WL/Mma do it. However, I post this answer to illustrate some functions for any user that wants to show steps etc:

z = x + I  y;
zc = z /. I -> -I;
lhs = Expand[(Sqrt[(z + I) (zc - I)] - Sqrt[(z - I) (zc + I)])^2] //
Simplify;
p1 = AddSides[lhs == 1, -2 - 2 x^2 - 2 y^2] // Simplify
p2 = #^2 & /@ p1 // Expand
p3 = MultiplySides[
AddSides[p2, -4 - 4 x^4 - 4 y^4 - 8 x^2 y^2 - 4 x^2 - 4 y^2], -1]
ContourPlot[p3, {x, -10, 10}, {y, -10, 10}, PlotLabel -> p3]


Of course, I apologize for any errors.