<jupyter_start><jupyter_text>The Alcubierre Drive Here we show how one might visualize the geometry of the warp drive solution proposed by Alcubierre. First, we import the libraries we will need. For the math functions (such as square root and hyperbolic trigonometric functions), we will need numpy. For plotting, we'll use matplotlib.pyplot. Finally, because we are making a 3D graph, we'll also import some 3D tools from matplotlib.<jupyter_code>from mpl_toolkits import mplot3d #these are the 3d tools mentioned above
import numpy as np #we can now reference numpy functions as np
import matplotlib.pyplot as plt #we can now reference matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Now, we need to cover some of the math behind the warp drive. First, note that the metric for his geometry (in Cartesian coordinates and natural units, G=c=1), is given byds²= -dt²+dx²+dy²+(dz-v(t)f(x, y, z-z₀(t))dt)²where f is a form function with value 0 outside the bubble and value 1 inside of it. Alcubierre chose spherically symmetric form functions, f(r(t)), r(t)=((z-z₀(t))²+x²+y²)¹/². We consider the case off(r)=(tanh(σ(r+R))-tanh(σ(r-R)))/(2tanh(σR))where R is the radius of the warp bubble and σ is inversely proportional to the thickness of the bubble wall. If σ is sufficiently large, f(r)=1 if r ∈ [0, R] and f(r)=0 if r ∈ (R, ∞).The expansion of the volume elements is given byθ = v((z-z₀)/r)(df(r)/dr).In order to plot this function, we need to choose a fixed value for z₀, v, R, and σ. Let's plot the particular case in which v=R=1, z₀=0, and σ=8. Then,θ = (4/tanh(8))(z/r)(sec²(8(r+1))-sec²(8(r-1))) = (4/tanh(8))(z/(√ρ²+z²))(sec²(8((√ρ²+z²)+1))-sec²(8((√ρ²+z²)-1))) Let's begin our program by defining this volume expansion element as a function of z and ρ. The reason is that these will be two of our axes.<jupyter_code>def theta(z, rho):
    return (4/np.tanh(8))*(z/np.sqrt(z**2+rho**2))*((1/np.cosh(8*(np.sqrt(z**2+rho**2)+1)))**2-(1/np.cosh(8*(np.sqrt(z**2+rho**2)-1)))**2)<jupyter_output><empty_output><jupyter_text>Now, we can use numpy to create the values for z and ρ that we wish to plot.<jupyter_code>z = np.linspace(-4, 4, 160) #gives a list of 160 equally spaced values between -4 and 4
rho = np.linspace(-4, 4, 160) #does the same

Z, RHO = np.meshgrid(z, rho) #creates two matrices from the two lists above<jupyter_output><empty_output><jupyter_text>Next, compute the values of theta that we will plot:<jupyter_code>THETA=theta(Z, RHO)<jupyter_output><empty_output><jupyter_text>Finally, plot the figure:<jupyter_code>fig = plt.figure()
ax = plt.axes(projection ='3d')
ax.plot_wireframe(Z, RHO, THETA, color ='black')
#ax.set_title('Volume plot for the Alcubierre drive')<jupyter_output><empty_output><jupyter_text>The image looks tiny... let's try to change the axes:<jupyter_code>z2 = np.linspace(-3, 3, 160) #gives a list of 160 equally spaced values between -4 and 4
rho2 = np.linspace(-3, 3, 160) #does the same

Z2, RHO2 = np.meshgrid(z2, rho2) #creates two matrices from the two lists above

THETA2=theta(Z2, RHO2)
fig2 = plt.figure()
ax2 = plt.axes(projection ='3d')
ax2.set_xlim([-3, 3])
ax2.set_ylim([-3, 3])
ax2.plot_wireframe(Z2, RHO2, THETA2, color ='black')
#ax2.set_title('Volume plot for the Alcubierre drive')<jupyter_output><empty_output><jupyter_text>We can zoom in even more:<jupyter_code>z3 = np.linspace(-2, 2, 160) #gives a list of 160 equally spaced values between -4 and 4
rho3 = np.linspace(-2, 2, 160) #does the same

Z3, RHO3 = np.meshgrid(z3, rho3) #creates two matrices from the two lists above

THETA3=theta(Z3, RHO3)

fig3 = plt.figure()
ax3 = plt.axes(projection ='3d')
ax3.set_xlim([-2, 2])
ax3.set_ylim([-2, 2])
ax3.plot_wireframe(Z3, RHO3, THETA3, color ='black')
#ax3.set_title('Volume plot for the Alcubierre drive')<jupyter_output><empty_output><jupyter_text>Now, let's try changing the values of some parameters, beginning with alpha.<jupyter_code>def theta_mod1(z, rho):
    return (2/np.tanh(4))*(z/np.sqrt(z**2+rho**2))*((1/np.cosh(4*(np.sqrt(z**2+rho**2)+1)))**2-(1/np.cosh(4*(np.sqrt(z**2+rho**2)-1)))**2)
z4 = np.linspace(-2, 2, 160) #gives a list of 160 equally spaced values between -4 and 4
rho4 = np.linspace(-2, 2, 160) #does the same

Z4, RHO4 = np.meshgrid(z4, rho4) #creates two matrices from the two lists above

THETA4=theta_mod1(Z4, RHO4)

fig4 = plt.figure()
ax4 = plt.axes(projection ='3d')
ax4.set_xlim([-2, 2])
ax4.set_ylim([-2, 2])
ax4.plot_wireframe(Z4, RHO4, THETA4, color ='black')
#ax4.set_title('Volume plot for the Alcubierre drive')<jupyter_output><empty_output><jupyter_text>Next, try changing R:<jupyter_code>def theta_mod2(z, rho):
    return (4/np.tanh(8))*(z/np.sqrt(z**2+rho**2))*((1/np.cosh(8*(np.sqrt(z**2+rho**2)+2)))**2-(1/np.cosh(8*(np.sqrt(z**2+rho**2)-2)))**2)
z5 = np.linspace(-2, 2, 160) #gives a list of 160 equally spaced values between -4 and 4
rho5 = np.linspace(-2, 2, 160) #does the same

Z5, RHO5 = np.meshgrid(z5, rho5) #creates two matrices from the two lists above

THETA5=theta_mod2(Z5, RHO5)

fig5 = plt.figure()
ax5 = plt.axes(projection ='3d')
#ax5.set_xlim([-2, 2])
#ax5.set_ylim([-2, 2])
ax5.plot_wireframe(Z5, RHO5, THETA5, color ='black')
#ax5.set_title('Volume plot for the Alcubierre drive')<jupyter_output><empty_output><jupyter_text>Finally, let's change v.<jupyter_code>def theta_mod3(z, rho):
    return 2*(4/np.tanh(8))*(z/np.sqrt(z**2+rho**2))*((1/np.cosh(8*(np.sqrt(z**2+rho**2)+1)))**2-(1/np.cosh(8*(np.sqrt(z**2+rho**2)-1)))**2)
z6 = np.linspace(-2, 2, 160) #gives a list of 160 equally spaced values between -4 and 4
rho6 = np.linspace(-2, 2, 160) #does the same

Z6, RHO6 = np.meshgrid(z6, rho6) #creates two matrices from the two lists above

THETA6=theta_mod3(Z6, RHO6)

fig6 = plt.figure()
ax6 = plt.axes(projection ='3d')
#ax6.set_zlim([-3, 3])
#ax5.set_xlim([-2, 2])
#ax5.set_ylim([-2, 2])
ax6.plot_wireframe(Z6, RHO6, THETA6, color ='black')
#ax6.set_title('Volume plot for the Alcubierre drive')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1612957087994657, 'fraction_numerical': 0.051093671731507764, 'mean_word_length': 5.539301310043668, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '214494', 'license': 'MIT', 'n_tokens_mistral': 2572, 'n_tokens_neox': 2450, 'n_words': 679, 'path': 'Alcubierre_drive_volume_plot.ipynb', 'repo_name': 'Lua-sketch/Alcubierre-drive', 'size': '5989'}