2
$\begingroup$

I have plotted the complex function $f(z) = z^2+1$ by using the following code:

ComplexPlot3D[z^2+1, {z, -5 - 5 I, 5 + 5 I}]

However, I want to show that $z^2+1$ intersects the line $\Re(z) = 0$. The z-coordinates of intersection are: $z = i$ and $z = -i$, because the roots can easily be found by factorising the function: $f(z) = (z+i)(z-i)$. How do I show that the function $f(z)$ intersects the line $\Re(z) = 0$ graphically in this 3D ComplexPlot?

My main objective is to show that if $f: \mathbb{R}\to\mathbb{R}$ is defined by $f(x) = x^2 +1$ ($x\in\mathbb{R}$), then the function doesn't intersect with $y = 0$ (or $f(x) = 0$), but it does intersect with $\Re(z) = 0$ if $f: \mathbb{C}\to\mathbb{C}$ is defined by $f(z) = z^2 + 1$ ($z\in\mathbb{C}$).

$\endgroup$
3
  • $\begingroup$ What do you mean by "the line $f(z) = 0$"? If $f(z) = z^2+1$, then the graph of $f(z) = 0$ is not a line. $\endgroup$
    – murray
    Commented May 5, 2019 at 15:11
  • $\begingroup$ Normally, the function doesn't intersect with y=0. However, it does if you take complex numbers into account. So I mean that specific line, which it intersects in $(i, 0)$ and $(-i, 0)$ $\endgroup$
    – Stallmp
    Commented May 5, 2019 at 15:13
  • $\begingroup$ @mjw Well, the question has already been answered, look at that answer. $\endgroup$
    – Stallmp
    Commented May 6, 2019 at 6:10

2 Answers 2

3
$\begingroup$
f[z_] = z^2 + 1;

ComplexPlot3D[f[z], {z, -5 - 5 I, 5 + 5 I},
 AxesLabel -> (Style[#, 12, Bold] & /@ {Re[z], Im[z], Abs[f[z]]}),
 PlotLegends -> Automatic]

enter image description here

f[z] == 0 is not a line but rather two points.

pts = {Re[#], Im[#], 0} & /@ (z /. Solve[f[z] == 0, z])

(* {{0, -1, 0}, {0, 1, 0}} *)

To see this graphically, limit the PlotRange and reverse the z-axis.

Show[
 ComplexPlot3D[f[z], {z, -5 - 5 I, 5 + 5 I},
  AxesLabel -> (Style[#, 12, Bold] & /@ {Re[z], Im[z], Abs[f[z]]}),
  PlotLegends -> Automatic,
  PlotRange -> {0, 1.1},
  ClippingStyle -> None,
  PlotPoints -> 125,
  ScalingFunctions -> {None, None, "Reverse"}],
 Graphics3D[{Black, AbsolutePointSize[4], Point /@ pts}]]

enter image description here

EDIT: To show the line that passes through pts

Show[
 ComplexPlot3D[f[z], {z, -5 - 5 I, 5 + 5 I},
  AxesLabel -> (Style[#, 12, Bold] & /@ {Re[z], Im[z], Abs[f[z]]}),
  PlotLegends -> Automatic,
  PlotRange -> {0, 1.1},
  ClippingStyle -> None,
  PlotPoints -> 125,
  ScalingFunctions -> {None, None, "Reverse"}],
 Graphics3D[{Black, Thick, InfiniteLine[pts]}]]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks a lot! I have one question, why does the reversed image look different compared to the first image? Isn't it supposed to be the same function? $\endgroup$
    – Stallmp
    Commented May 5, 2019 at 16:18
  • $\begingroup$ @Stallmp - It is the same function; however, at the PlotRange of the first plot you cannot see the details of the "dimples". Look at Manipulate[ ComplexPlot3D[f[z], {z, -5 - 5 I, 5 + 5 I}, AxesLabel -> (Style[#, 12, Bold] & /@ {Re[z], Im[z], Abs[f[z]]}), PlotLegends -> Automatic, PlotRange -> {0, zmax}, PlotPoints -> 125, ScalingFunctions -> {None, None, "Reverse"}, ClippingStyle -> None], {{zmax, 45}, 1, 45, 0.5, Appearance -> "Labeled"}, SynchronousUpdating -> False] $\endgroup$
    – Bob Hanlon
    Commented May 5, 2019 at 16:34
  • $\begingroup$ Thanks a lot for the help! $\endgroup$
    – Stallmp
    Commented May 5, 2019 at 16:47
4
$\begingroup$

Using just built-in functions

Show[
  ComplexPlot3D[z^2 + 1, {z, -5 - 5 I, 5 + 5 I}, ColorFunction -> "LightTerrain"], 
  ComplexPlot3D[0, {z, -5 - 5 I, 5 + 5 I}, ColorFunction -> "LightTerrain", PlotStyle -> Opacity[0.5]],
  Graphics3D[{Thick, Red, Line[{{0, -5, 0}, {0, 5, 0}}]}],
  Axes -> True, AxesOrigin -> {0, 0, 0}, 
  AxesLabel -> {Re[z], Im[z], w}, Boxed -> False, 
  PlotRange -> {-10, 50}, BoxRatios -> {1, 1, 0.5}]

A complex plot in 3D

Probably a different viewpoint would show better what's going on.

Using David Park's Presentations add-on

This add-on allows, among many other features, working directly with complex graphics objects and complex functions; it includes functions such as ComplexCartesianSurface that predate the functions such as ComplexPlot3D introduced in Mathematica 12.0. (To obtain Park's add-on, see: Where is David Park's Mathematica site?.)

Since Presentations does not include a function that maps points in the complex plane to points in space, let's define a simple version of one:

complexTo3D[pts_, z_] := Append[z] /@ ReIm[pts]

The function:

f[z_] := z^2 + 1

Load Park's add-on:

<< Presentations`

And create the 3D graphic:

With[{zmin = -1 - 1.75 I, zmax = 1 + 1.75 I},
  zeros = z /. Solve[f[z] == 0, z];
  Draw3DItems[
    {
     Opacity[0.85],
     ComplexCartesianSurface[f[z], Abs, {z, zmin, zmax},
       PlotPoints -> 50,
       Mesh -> 12,
       MeshFunctions ->
         {Function[{x, y, z, u, v}, Re[f[u + I v]]],
          Function[{x, y, z, u, v}, Im[f[u + I v]]]},
       MeshStyle -> {White, LightGray},
       ColorFunction -> 
         Function[{x, y, z, u, v}, ColorData["RedGreenSplit"][Rescale[Arg[f[u + I v]], {-\[Pi], \[Pi]}]]],
       ColorFunctionScaling -> False,
     ScalingFunctions -> {None, None, "Reverse"}
     ],
     Opacity[0.3],
     ComplexCartesianSurface[0, Abs, {z, zmin, zmax},
       Mesh -> None, PlotStyle -> LighterGray,
       ScalingFunctions -> {None, None, "Reverse"},
       PlotTheme -> "Classic"
     ],
     PointSize[Large], Red, Point /@ complexTo3D[zeros, 0]
   },
   BaseStyle -> {12, Bold},
   PlotRange -> {-4, 0.75},
   Boxed -> False, Axes -> True, AxesOrigin -> {0, 0, 0}, 
   AxesLabel -> {Re[z], Im[z], Abs[f[z]]},
   Ticks -> False,
   BoxRatios -> {1, 1, 0.75}
  ]
 ]

Zeros of z^2 + 1 using Presentations add-on

The mesh on the graph of $\lvert f(z)\rvert$ is formed by level curves of $\Re(f(z)$ and $\Im(f(z)$, while the coloring is obtained from $\arg(f(z))$. (This may be visual overload!)

One could doubtless experiment with the various colors to obtain a more informative, or at least more pleasing, image. Note that I've exploited the enhancement from @BobHanlon's answer of reversing the direction of the f(z)-axis.

$\endgroup$
2
  • $\begingroup$ Thanks a lot! That's what I was looking for indeed. $\endgroup$
    – Stallmp
    Commented May 5, 2019 at 16:47
  • $\begingroup$ @murray can you provide the example using presentations? And a link to the add-on on David Park’s site would be beneficial also. Nice job! $\endgroup$ Commented May 8, 2019 at 4:16

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.