广义相对论--python画克鲁斯卡坐标

本文通过Matplotlib展示Kruskal坐标系中不同r值和t值下的等面图,包括r=rs、r<rs和r>rs的情况,帮助读者理解时空变化对Kruskal坐标的影响。通过实例展示了r值变化下对应的v和u曲线,以及t值固定时的轨迹,有助于深入理解广义相对论中的坐标转换。
摘要由CSDN通过智能技术生成
import numpy as np
import matplotlib.pyplot as plt

rs = 1
NUM = 100
R = np.linspace(-10.2,1,NUM)
R_1 = np.linspace(1,4.2,NUM)
t = np.linspace(-10.2,10.2,NUM)
plt.axhline(y=0,xmin=-2,xmax=2,color='k', linestyle='--')
plt.vlines(0,-2,2,color='k', linestyle='--')
# 等 r 面
# r = rs
#=============================r=1=============================
v = np.linspace(0,2,NUM)
u = np.linspace(0,2,NUM)
plt.plot(u,v,'k-',lw=2)
plt.plot(-u,v,'k-',lw=2)
plt.plot(u,-v,'k-',lw=2)
plt.plot(-u,-v,'k-',lw=2)
plt.axis('tight')
plt.xlabel('u')
plt.ylabel('v')
ax = plt.gca()
ax.set_title('Kruskal coordinate')

# r < rs
#=============================r=0.95===========================
r1 = 0.95
v1 = np.sqrt(1-(r1/rs))*np.exp(r1/2*rs)*np.cosh(t/2*rs)
u1 = np.sqrt(1-(r1/rs))*np.exp(r1/2*rs)*np.sinh(t/2*rs)
plt.plot(u1,v1,'r-')
plt.plot(u1,-v1,'g-')
plt.axis('tight')
#=============================r=0.9===========================
r2 = 0.85
v2 = np.sqrt(1-(r2/rs))*np.exp(r2/2*rs)*np.cosh(t/2*rs)
u2 = np.sqrt(1-(r2/rs))*np.exp(r2/2*rs)*np.sinh(t/2*rs)
plt.plot(u2,v2,'r-')
plt.plot(u2,-v2,'g-')
plt.axis('tight')
#=============================r=0.7=============================
r3 = 0.7
v3 = np.sqrt(1-(r3/rs))*np.exp(r3/2*rs)*np.cosh(t/2*rs)
u3 = np.sqrt(1-(r3/rs))*np.exp(r3/2*rs)*np.sinh(t/2*rs)
plt.plot(u3,v3,'r-')
plt.plot(u3,-v3,'g-')
plt.axis('tight')
#=============================r=0============================
r4 = 0
v4 = np.sqrt(1-(r4/rs))*np.exp(r4/2*rs)*np.cosh(t/2*rs)
u4 = np.sqrt(1-(r4/rs))*np.exp(r4/2*rs)*np.sinh(t/2*rs)
plt.plot(u4,v4,'r-',lw=3)
plt.plot(u4,-v4,'g-',lw=3)
plt.axis('tight')
# r > rs
#=============================r=1.07=============================
R1 = 1.07
U1 = np.sqrt((R1/rs)-1)*np.exp(R1/2*rs)*np.cosh(t/2*rs)
V1 = np.sqrt((R1/rs)-1)*np.exp(R1/2*rs)*np.sinh(t/2*rs)
plt.plot(U1,V1,'r-')
plt.plot(-U1,V1,'g-')
plt.axis('tight')

#=============================r=1.2=============================
R2 = 1.2
U2 = np.sqrt((R2/rs)-1)*np.exp(R2/2*rs)*np.cosh(t/2*rs)
V2 = np.sqrt((R2/rs)-1)*np.exp(R2/2*rs)*np.sinh(t/2*rs)
plt.plot(U2,V2,'r-')
plt.plot(-U2,V2,'g-')
plt.axis('tight')

#=============================r=1.3=============================
R3 = 1.3
U3 = np.sqrt((R3/rs)-1)*np.exp(R3/2*rs)*np.cosh(t/2*rs)
V3 = np.sqrt((R3/rs)-1)*np.exp(R3/2*rs)*np.sinh(t/2*rs)
plt.plot(U3,V3,'r-')
plt.plot(-U3,V3,'g-')
plt.axis('tight')
#=============================r=1.4=============================
R4 = 1.4
U4 = np.sqrt((R4/rs)-1)*np.exp(R4/2*rs)*np.cosh(t/2*rs)
V4 = np.sqrt((R4/rs)-1)*np.exp(R4/2*rs)*np.sinh(t/2*rs)
plt.plot(U4,V4,'r-')
plt.plot(-U4,V4,'g-')
plt.axis('tight')
# 等 t 面 r < rs
#=============================t=1.2=============================
#t1 = 1.2
t1 = 1.2
v_1 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.cosh(t1/2*rs)
u_1 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.sinh(t1/2*rs)
plt.plot(u_1,v_1,'b-')
plt.plot(u_1,-v_1,'m-')
plt.axis('tight')
#=============================t=0.5=============================
#t2 = 0.5
t2 = 0.5
v_2 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.cosh(t2/2*rs)
u_2 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.sinh(t2/2*rs)
plt.plot(u_2,v_2,'b-')
plt.plot(u_2,-v_2,'m-')
plt.axis('tight')

#=============================t=-0.5=============================
#t3 = -0.5
t3 = -0.5
v_3 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.cosh(t3/2*rs)
u_3 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.sinh(t3/2*rs)
plt.plot(u_3,v_3,'b-')
plt.plot(u_3,-v_3,'m-')
plt.axis('tight')
#=============================t=-1.2=============================
#t4 = -1.2
t4 = -1.2
v_4 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.cosh(t4/2*rs)
u_4 = np.sqrt(1-(R/rs))*np.exp(R/2*rs)*np.sinh(t4/2*rs)
plt.plot(u_4,v_4,'b-')
plt.plot(u_4,-v_4,'m-')
plt.axis('tight')


# 等 t 面 r > rs
#=============================t=1.2=============================
T1 = 1.2
U_1 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.cosh(T1/2*rs)
V_1 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.sinh(T1/2*rs)
plt.plot(U_1,V_1,'b-')
plt.plot(-U_1,V_1,'m-')
plt.xlim(-2,2.0)
plt.ylim(-2,2)
plt.axis('tight')
#=============================t=0.5=============================
T2 = 0.5
U_2 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.cosh(T2/2*rs)
V_2 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.sinh(T2/2*rs)
plt.plot(U_2,V_2,'b-')
plt.plot(-U_2,V_2,'m-')
plt.xlim(-2,2.0)
plt.ylim(-2,2)
plt.axis('tight')

#=============================t=-0.5=============================
T3 = -0.5
U_3 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.cosh(T3/2*rs)
V_3 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.sinh(T3/2*rs)
plt.plot(U_3,V_3,'b-')
plt.plot(-U_3,V_3,'m-')
plt.xlim(-2,2.0)
plt.ylim(-2,2)
plt.axis('tight')
#=============================t=-1.2=============================
T4 = -1.2
U_4 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.cosh(T4/2*rs)
V_4 = np.sqrt((R_1/rs)-1)*np.exp(R_1/2*rs)*np.sinh(T4/2*rs)
plt.plot(U_4,V_4,'b-')
plt.plot(-U_4,V_4,'m-')
#plt.legend()
plt.xlim(-2,2.0)
plt.ylim(-2,2)

结果:在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

X射线双星

希望您继续支持我

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值