# Plotting two surfaces in cylindrical coordinates

Hello,
I need to plot the following surfaces given by:
where \rho is the radius, z is the height and \phi is the azimuth. c,\alpha,\phi_0 are constants with c\geq\alpha.
The first surface is a torus, but I can’t get anything similar to a torus when I try to plot it

What have you tried? It is much easier to help you if you have mostly working code to start from.

import numpy as np
import matplotlib.pyplot as plt

def cart2pol(x, y):
rho = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return(rho, phi)

def pol2cart(rho, phi):
x = rho * np.cos(phi)
y = rho * np.sin(phi)
return(x, y)

c=25
a=5

r=np.linspace(0,20,200,endpoint=True)
phi=np.linspace(0,2*np.pi,200,endpoint=True)

x,y=pol2cart(r,phi)

z=np.zeros((2,200))
z[0][:]=np.sqrt((c**2-a**2-(r-c)**2))
z[1][:]=-z[0][:]

fig = plt.figure()
ax = fig.gca(projection='3d')

ax.plot_surface(x, y, z, antialiased=True, color='orange')