【发布时间】:2020-03-21 01:49:22
【问题描述】:
我正在尝试使用 python 求解测地线轨道方程系统。它们是耦合的常方程。我尝试了不同的方法,但它们都产生了错误的形状(在绘制 r 和 phi 时,形状应该是一些周期函数)。关于如何做到这一点的任何想法? 这是我的常量
G = 4.30091252525 * (pow(10, -3)) #Gravitational constant in (parsec*km^2)/(Ms*sec^2)
c = 0.0020053761 #speed of light , AU/sec
M = 170000 #mass of the central body, in solar masses
m = 10 #mass of the orbiting body, in solar masses
rs = 2 * G * M / pow(c, 2) #Schwarzschild radius
Lz= 0.000024 #Angular momemntum
h = Lz / m #Just the constant in equation
E= 1.715488e-007 #energy
初始条件为:
Y(0) = rs
Phi(0) = math.pi
轨道方程
我尝试这样做的方式:
def rhs(t, u):
Y, phi = u
dY = np.sqrt((E**2 / (m**2 * c**2) - (1 - rs / Y) * (c**2 + h**2 / Y**2)))
dphi = L / Y**2
return [dY, dphi]
Y0 = np.array([rs,math.pi])
sol = solve_ivp(rhs, [1, 1000], Y0, method='Radau', dense_output=True)
【问题讨论】:
-
您能否就变量代表什么以及它们的单位是什么添加一些解释或代码 cmets?您希望涵盖多少个时期,结果如何? // 你离题了,因为这更像是一个物理或数字问题,因此更适合 scicomp.SE、physics.SE 或 math.SE。如果对此采取行动,请避免(隐藏)交叉发布。
-
你是如何解出第一个方程中的符号的?你确定二阶导数是连续的吗?
-
到目前为止您尝试过什么?你知道scipy.integrate吗?
-
用附加信息和我的代码更新了帖子!对于符号,我只取了一个平方根,因为它可以提供我需要的部分解决方案。而且我没有检查二阶导数的连续性。我怎样才能在 Python 中做到这一点?
-
您正在混合长度单位 km、AU 和 parsec。角动量和能量的单位没有给出,也可能是混合比例的。数值结果没有理由接近某种物理预期。
标签: python physics differential-equations astronomy