1
$\begingroup$

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?

EDIT:

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.

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

1 Answer 1

5
$\begingroup$

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)] &); 

enter image description here

$\endgroup$
2
  • $\begingroup$ The palette "mycolor" is not defined in the above code snippet. $\endgroup$ Commented Jan 25, 2021 at 4:06
  • $\begingroup$ Sorry, I'll add, I found the notebook. $\endgroup$ Commented Jan 25, 2021 at 19:16

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.