# How to reproduce the Riemann Surface of Log[z]

I found this plot on Wikipedia: 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,
]


which produces the output: 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?

# EDIT:

I already read this question but by plotting with that code the Log[z] function I obtain this result: which is clear not what I want.

• This may be helpful: mathematica.stackexchange.com/questions/31904/… Aug 9, 2017 at 18:35
• 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. Aug 9, 2017 at 18:45
• 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. Aug 9, 2017 at 18:45
• So, why did you not then try MeshFunctions with the real and imaginary parts of the logarithm? Aug 10, 2017 at 8:59
• If, as you say, you've figured it out, please do answer your own question. Aug 10, 2017 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
]


color palette to obtain some very similar result is reported below

mycolor = (
Blend[
{
{1, RGBColor[0.512917, 1., 0.0319219]},
{0.669069, RGBColor[1., 1., 0.041413]}, {0.461286,
RGBColor[0.985946, 0., 0.0269474]},
{0.226004, RGBColor[0.985153, 0., 0.79292]},
{0, RGBColor[0.495415, 0., 0.998459]}
},
(1 - #3)]
&); • The palette "mycolor" is not defined in the above code snippet. Jan 25, 2021 at 4:06
• Sorry, I'll add, I found the notebook. Jan 25, 2021 at 19:16