I found this plot on Wikipedia:

enter image description here

which is the plot of the

multi-valued imaginary part of the complex logarithm function, which shows the branches.

So I tried to reproduce myself with the code:

myGradient = (Blend[{{0.345556, RGBColor[0.985, 0., 0.870436]}, {0, 
       RGBColor[0.359518, 0., 0.81767]}, {1, 
       RGBColor[0.443748, 1., 0.0305638]}, {0.572157, 
       RGBColor[0.985946, 0., 0.0269474]}, {0.79284, 
       RGBColor[1., 1., 0.041413]}}, #3] &);

Plot3D[{Im[Log[x + I y]], Im[Log[x + I y]] + 2 Pi, 
  Im[Log[x + I y]] + 4 Pi}, 
  {x, -4, 4}, {y, -4, 4}, 
  BoxRatios -> {1, 1, 1}, 
  ImageSize -> Medium, 
  Mesh -> 25, 
  ColorFunction -> myGradient

which produces the output:

enter image description here

As you can notice I wasn't able to reproduce the curvy grid, which, instead, is the normal square grid of the Plot3D function. Further mor I have those strange white spaces which I would like to cover, to obtain an image the more similar to the one on Wikipedia.

Some ideas?


I already read this question but by plotting with that code the Log[z] function I obtain this result:

enter image description here

which is clear not what I want.

  • $\begingroup$ This may be helpful: mathematica.stackexchange.com/questions/31904/… $\endgroup$ – Jason B. Aug 9 '17 at 18:35
  • 1
    $\begingroup$ so the surface is correct, you just want different mesh lines? The first question to ask is, what function of z do the mesh lines you want follow? The wikipedia page isn't clear on that. $\endgroup$ – Jason B. Aug 9 '17 at 18:45
  • 3
    $\begingroup$ What if you added MeshFunctions -> {#1^2 + #2^2 &, ArcTan[#2, #1] &} as an option in the Plot3D call? That might not be quite it, but if you can figure out what the contour lines are, then you can adapt these functions to that. $\endgroup$ – march Aug 9 '17 at 18:45
  • 1
    $\begingroup$ So, why did you not then try MeshFunctions with the real and imaginary parts of the logarithm? $\endgroup$ – J. M.'s technical difficulties Aug 10 '17 at 8:59
  • 1
    $\begingroup$ If, as you say, you've figured it out, please do answer your own question. $\endgroup$ – J. M.'s technical difficulties Aug 10 '17 at 9:13

What I was looking for was to obtain the mesh lines of the mapping of a square grid on the complex plane $\mathbb{C}$ under the Log[z] transformation. So actually, to obtain the mesh lines in the image I posted (which is actually not so precise, as the lines coming from the origin don't seem to be straight lines), using the command MeshFunction, as suggested by march, who I thank, you only need to provide to it as functions respectively the imaginary and real part of the Log[z]:

Plot3D[{Im[Log[x + I y]], Im[Log[x + I y]] + 2 Pi, 
  Im[Log[x + I y]] - 2 Pi},
    {x, -range, range}, {y, -range, range}, 
    BoxRatios -> {1, 1, 1.5},
    PlotRange -> All,
    PlotPoints -> 50, 
    Mesh -> 30,
    MeshFunctions -> {Im[Log[#1 + I #2]] &, Re[Log[#1 + I #2]] &},
    ImageSize -> Large, 
    ColorFunction -> mycolor

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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