0
$\begingroup$

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.

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

4 Answers 4

1
$\begingroup$
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]]

enter image description here

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

enter image description here

$\endgroup$
3
$\begingroup$

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]

enter image description here

$\endgroup$
1
  • $\begingroup$ I think this solution expends way more effort than this problem warrants. $\endgroup$ Dec 10, 2015 at 14:30
2
$\begingroup$
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]

enter image description here

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]]],
 PlotRangePadding -> 1,
 Axes -> False]

enter image description here

Using ComplexRegionPlot (new in 12.1)

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

enter image description here

$\endgroup$
2
$\begingroup$

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]

enter image description here

Of course, I apologize for any errors.

$\endgroup$

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.