Plotly plot of the Riemann surface, real part of the $4^{th}$ root, $\Re(\sqrt[4]{z})$


In [1]:
import numpy as np
from numpy import pi
import plotly.graph_objects as go
import plotly
plotly.offline.init_notebook_mode()


Below are given two HSV colorscales, generated as in this notebook.


In [2]:
pl_hsv1 = [[0.0, 'rgb(0, 242, 242)'],#S=1, V=0.95, ty=1, i.e. [-pi, pi) is mapped to this colorscale
 [0.083, 'rgb(0, 121, 242)'],
 [0.166, 'rgb(0, 0, 242)'],
 [0.25, 'rgb(121, 0, 242)'],
 [0.333, 'rgb(242, 0, 242)'],
 [0.416, 'rgb(242, 0, 121)'],
 [0.5, 'rgb(242, 0, 0)'],
 [0.583, 'rgb(242, 121, 0)'],
 [0.666, 'rgb(242, 242, 0)'],
 [0.75, 'rgb(121, 242, 0)'],
 [0.833, 'rgb(0, 242, 0)'],
 [0.916, 'rgb(0, 242, 121)'],
 [1.0, 'rgb(0, 242, 242)']]

pl_hsv2 = [[0.0, 'rgb(242, 0, 0)'],#S=1, V=0.95, ty=2; the interval [0, 2 pi) is mapped on pl_hsv2
 [0.083, 'rgb(242, 121, 0)'],
 [0.166, 'rgb(242, 242, 0)'],
 [0.25, 'rgb(121, 242, 0)'],
 [0.333, 'rgb(0, 242, 0)'],
 [0.416, 'rgb(0, 242, 121)'],
 [0.5, 'rgb(0, 242, 242)'],
 [0.583, 'rgb(0, 121, 242)'],
 [0.666, 'rgb(0, 0, 242)'],
 [0.75, 'rgb(121, 0, 242)'],
 [0.833, 'rgb(242, 0, 242)'],
 [0.916, 'rgb(242, 0, 121)'],
 [1.0, 'rgb(242, 0, 0)']]

Plot the Riemann surface $\Re(\sqrt[4]{z})$, with z in the unit disk:


In [3]:
rho = np.linspace(0, 1, 40)
phi= np.linspace(-pi, pi, 150) # it's important to set the range (-pi, pi. With (0,2 pi) the argumet of w 
                                       #appears as dicontinuous
rho, phi=np.meshgrid(rho,phi)
X = rho*np.cos(phi)
Y = rho*np.sin(phi)
Z = X + 1j * Y
r = np.absolute(Z)
theta = np.angle(Z)
sqrt4mod = r**(1./4)
theta /= 4

#f(z)=Re(sqrt[4](z)) has the argument of each branch as follows:
#branch 0: [-pi/4, pi/4) included in [-pi, pi), colored pl_hsv1
#branch 1: [pi/4, 3 pi/4) included in [-pi, pi), colored pl_hsv1
#branch 2: [3 pi/4, 5 pi/4) included in [0, 2 pi), colored pl_hsv2
#branch 3: [5 pi/4, 7 pi/4] included in [0, 2 pi), colored pl_hsv2

cmin=[-pi, -pi, 0, 0] #https://plot.ly/python/reference/#surface-cmin
cmax=[pi, pi, 2*pi, 2*pi] #https://plot.ly/python/reference/#surface-cmax
    
colsc = [pl_hsv1, pl_hsv1, pl_hsv2, pl_hsv2] #colorscale for each branch
traces=[]
for k in range(4):
    phi = theta + 2*k*pi/4
    #print np.min(phi)*180/pi, np.max(phi)*180/pi #print the interval of the argument (in degrees) for each branch
    real = sqrt4mod * np.cos(phi)
    traces += [go.Surface(x=X, y=Y, z=real, colorscale=colsc[k], surfacecolor=phi, 
                          showscale=False, cmin=cmin[k], cmax=cmax[k])]

In [6]:
fig = go.Figure(data=traces)

fig.update_layout(title_text='$\\text{Riemann surface} \quad \\Re(\\sqrt[4]z)$', 
                  title_x=0.5,
                  width=700,
                  height=700)
fig.update_scenes(xaxis_title='Re(z)',
                  yaxis_title='Im(z)', 
                  zaxis_title='Re(f(z))')
plotly.offline.iplot(fig)



In [7]:
from IPython.core.display import HTML
def  css_styling():
    styles = open("./custom.css", "r").read()
    return HTML(styles)
css_styling()


Out[7]: