Ask Your Question
0

How can I get an image in 3D using the axial symmetry of the graph in polar coordinates.

asked 2020-05-14 13:20:49 +0100

aszanti gravatar image

updated 2020-05-15 01:07:17 +0100

slelievre gravatar image

I have equations and the 2D curve drawing in polar coordinates.

Equations and 2D curve drawing in polar coordinates.

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

# 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)

Plot both charts for parameters beta=0.8, R=1, d=2.

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))
p
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-05-15 18:45:16 +0100

Juanjo gravatar image

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.

edit flag offensive delete link more

Comments

Thank you very much, I was looking for this image (Lorentz transformation). Thanks.

aszanti gravatar imageaszanti ( 2020-05-16 12:08:01 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-14 13:20:49 +0100

Seen: 285 times

Last updated: May 15 '20