Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I suppose that by "using the axial symmetry of the graph in polar coordinates" you mean by rotating around the polar axis. In such a case, initially you have the plot of curve in the $xy$ plane given by

$$\begin{aligned}x&=r(\phi) \cos\phi,\\ y&=r(\phi)\sin\phi,\end{aligned}$$

with $\phi$ in a given interval $[a,b]$. When a point $(x,y)$ starts rotating around the $x$-axis (which is the polar axis), it describes a circle where the $x$-coordinate remains constant and $y$ and $z$ are given by

$$\begin{aligned}y&=r(\phi) \sin\phi\cos\theta,\\ z&=r(\phi)\sin\phi\sin\theta,\end{aligned}$$

$\theta$ being the rotation angle. Due to the axial symmetry of the initial graph, it suffices to take $\theta$ in $[0,\pi]$. Joining all the pieces, we get a parametric surface given by

$$\begin{aligned}x&=r(\phi) \cos\phi, \\ y&=r(\phi) \sin\phi\cos\theta,\\ z&=r(\phi)\sin\phi\sin\theta,\end{aligned}\qquad (\phi,\theta)\in[a,b]\times[0,\pi].$$

You can plot this surface with parametric_plot3d. However, since the above equations resemble a change to spherical coordinates, it is simpler to define a coordinate transformation and use plot3d.

The following code generates the 2D and 3D plots:

var('beta, phi, R, d, r, theta')

# Transformation function
a(phi, beta) = (cos(phi) + beta)/(1 + beta*cos(phi))

# Two equations in polar coordinates
r1(phi, beta, R, d) = d*a + sqrt(d^2*(a^2 - 1) + R^2)
r2(phi, beta, R, d) = d*a - sqrt(d^2*(a^2 - 1) + R^2)

# 2D plot
p = polar_plot(r1(phi, 0.8, 1, 2), (-pi/2 + 0.16, -0.16 + pi/2), color='red')
p += polar_plot(r2(phi, 0.8, 1, 2), (-pi/2 + 0.18, pi/2 - 0.18))
show(p)

# 3D plot
Rotation = (r*cos(phi), r*sin(phi)*cos(theta), r*sin(phi)*sin(theta))
s1 = plot3d(r1(phi, 0.8, 1, 2), (phi,-pi/2 + 0.16, -0.16 + pi/2), (theta,0,pi), 
            transformation=Rotation, color='red', opacity=0.9)
s2 = plot3d(r2(phi, 0.8, 1, 2), (phi,-pi/2 + 0.18, -0.18 + pi/2), (theta,0,pi), 
            transformation=Rotation, color='blue')
Ox = arrow((0,0,0), (3.5,0,0), color="gray") + text3d("x", (3.6,0,0))
Oy = arrow((0,0,0), (0,2.2,0), color="gray") + text3d("y", (0,2.3,0))
Oz = arrow((0,0,0), (0,0,2.2), color="gray") + text3d("z", (0,0,2.3))
show(s1+s2+Ox+Oy+Oz)

You can see them in this SageCell.