I'm starting to study complex analysis,so I'm trying out Mathematica as tool for visualizing complex functions. I'm trying to graph $f(z)=z^2 + 1$ with the code:

ComplexPlot3D[z^2 + 1 , {z, 2}]

and what I get is this:

enter image description here

Something is wrong, because I expected negative real values of f(z) along the imaginary input axis. So I looked for a description of the function ComplexPlot3D[] and it says:

ComplexPlot3D[f,{z,Subscript[z, min],Subscript[z, max]}] 

generates a 3D plot of Abs[f] colored by Arg[f] over the complex rectangle with corners Subscript[z, min] and Subscript[z, max].

So the problem is that this plot function evaluates the absolute value (Abs[f]) instead of the actual value of the funtion it is plotting. Do any of you know how to fix this, or can point me to another function instead of this one? Thanks!

  • $\begingroup$ Would this suit better your purpose? ComplexPlot[(z^2 + 1), {z, 2}, ColorFunction -> "CyclicLogAbsArg"] $\endgroup$
    – chris
    Oct 10, 2022 at 6:38
  • $\begingroup$ a complex function f[z] in fact have two variables and two values, so we need to use four variables to express such f. That is why we always write f[z] as {u[x,y],v[x,y]}. It is recommend to use ParametricPlot. $\endgroup$
    – cvgmt
    Oct 10, 2022 at 14:53
  • $\begingroup$ Technically, your plot does indicate which values are real and negative — they're those points with $\arg f(z) = \pi$, which shows up as the points in cyan on the surface. $\endgroup$ Oct 10, 2022 at 16:38

2 Answers 2


How about

  ComplexPlot3D[z^2 + 1, {z, 2}, ColorFunction -> "CyclicLogAbsArg"]

enter image description here


You can plot the real and imaginary parts of the function separately using Plot3D and ReIm:

Plot3D[Evaluate[ReIm[f[x + I y]]], {x, -2, 2}, {y, -2, 2}]

enter image description here

This is a bit confusing on its own, to be honest, but if you look at it you can convince yourself that the points along the imaginary axis (with $|\Im(z)| > 1$) have $\Re(f(z)) < 0$ and $\Im(f(z)) = 0$.

Alternately, replacing ReIm with Re or Im will plot the real or imaginary parts of the function alone, which might make the above properties clearer.


Your Answer

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

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