# How to visualize Riemann surfaces?

In WolframAlpha we can easily visualize Riemann surfaces of arbitrary functions,

can we plot the Riemann surface of an arbitrary function using Mathematica and with a better color scheme like these plots so that I can see the connection of the branches?

Edit

Here are more Riemann surfaces by Matthias Nieser et. Automatic Generation of Riemann Surface Meshes

related:

How can I recreate Trott's Riemann Surface plot in Mathematica?

Visualization of Riemann Surfaces of Algebraic Functions

Automatic Generation of Riemann Surface Meshes

• Perhaps should mention How can I recreate Trott's Riemann Surface plot in Mathematica? Sep 8, 2013 at 17:40
• @Artes That's where confuses me. Does this kind of visualization of the Riemann surface in 3D is called "Trott's Riemann surface plot", or this color scheme is brought up by Trott? There are lots this kind of plot in the wiki page of Riemann surface, but none of them referred to "Trott". Also matlab has a function cplxmap that can plot this kind of 3d Riemann surface, and it doesn't mention "Trott" either. Sep 8, 2013 at 17:57
• Take a look at the first sentence in the question from the link Artes provided.
– Kuba
Sep 8, 2013 at 18:03
• These are one of a number of ways to depict a Riemann surface. Another way, in my Application, is to use a multifunction capability and show a Riemann plane and using a Locator point with an attached arrow representing the complex value at that point. Dragging around the locator allows one to explore all parts of the surface in a smooth, single valued, continuous manner (just as Riemann claimed). With the Sqrt function you have to circle the origin twice to get back to the same point. You would have to contact me by email for more information. Sep 8, 2013 at 19:15
• This is a link to Riemann surfaces of algebraic functions: jujusdiaries.com Apr 15, 2017 at 12:46

You can take Michael Trott's code and modify it a bit to easily plot these surfaces

RiemannSurfacePlot3D.m"]
rsurf[func_] :=
Grid[{{RiemannSurfacePlot3D[w == func, Re[w], {z, w},
ImageSize -> 400,
Coloring -> Hue[Rescale[ArcTan[1.4 Im[w]], {-Pi/2, Pi/2}]],
PlotPoints -> {40, 40}, Boxed -> False],
RiemannSurfacePlot3D[w == func, Im[w], {z, w}, ImageSize -> 400,
Coloring -> Hue[Rescale[ArcTan[1.4 Re[w]], {-Pi/2, Pi/2}]],
PlotPoints -> {40, 40}, Boxed -> False]}}];

Here it is applied to the functions from the OP

rsurf /@ {Sqrt[z], Log[z], (z + 1)^(1/3) + (z - 1)^(1/2)}

It is a bit tricky to get a nice coordinate mesh in these plots since we aren't actually using a plotting program (like ParametricPlot3D or Plot3D) to make them. We are instead building up a list of Polygon objects and combining them into a GraphicsComplex. However, we can get a decent approximation of a coordinate mesh by changing the line EdgeForm[] to EdgeForm[Black]

RiemannSurfacePlot3D.m"]
rsurf[func_] :=
Grid[{{RiemannSurfacePlot3D[w == func, Re[w], {z, w},
ImageSize -> 400,
Coloring -> Hue[Rescale[ArcTan[1.4 Im[w]], {-Pi/2, Pi/2}]],
PlotPoints -> {30, 20}, Boxed -> False],
RiemannSurfacePlot3D[w == func, Im[w], {z, w}, ImageSize -> 400,
Coloring -> Hue[Rescale[ArcTan[1.4 Re[w]], {-Pi/2, Pi/2}]],
PlotPoints -> {30, 20}, Boxed -> False]}}]/.(EdgeForm[]:>EdgeForm[Black]);

You can change the PlotPoints above to change the number of polygons drawn, and thus the quality of the 3D image and the density of mesh lines. The two numbers refer to the azimuthal and radial directions, respectively.

rsurf@Sqrt[1 - z^2]

• That's nice, could you add the mesh lines for better visualization? May 15, 2016 at 21:46
• @xslittlegrass, see the edit. It took a while to find how to do it since Trott didn't use any built-in plotting functions. If I were a better mathematician I could deconstruct his package and refit it to use ParametricPlot3D, but I couldn't. May 17, 2016 at 13:54
• thank you, that looks really nice! ParametricPlot3D was introduced very early (version 2), do you know why he didn't use it in the package? May 17, 2016 at 14:01
• I want to say it's because Trott is such a MMA kung-fu master that he doesn't need anything but some polygons and vertex colors to make a better 3D plotting program than is available out of the box. But there's probably a better reason than that. May 17, 2016 at 14:04
• BTW: have you seen Trott's earlier series of articles? You should see there his rationale for his strategy of using NDSolve[] in generating these surfaces. (I'm still annoyed that he never got to the special functions.) May 17, 2016 at 14:50