在python中绘制轨道轨迹

 

问题描述:

如何在python中设置三体问题?如何定义求解ODE的函数?

这三个方程是
x'' = -mu / np.sqrt(x ** 2 + y ** 2 + z ** 2) * x
y'' = -mu / np.sqrt(x ** 2 + y ** 2 + z ** 2) * y
z'' = -mu / np.sqrt(x ** 2 + y ** 2 + z ** 2) * z

我们写成6阶

x' = x2

y' = y2

z' = z2

x2' = -mu / np.sqrt(x ** 2 + y ** 2 + z ** 2) * x

y2' = -mu / np.sqrt(x ** 2 + y ** 2 + z ** 2) * y

z2' = -mu / np.sqrt(x ** 2 + y ** 2 + z ** 2) * z

我还想在“ Plot o Earth’s orbit and Mars”的路径中添加我们可以假定为圆形的路径。地球149.6 * 10 ** 6距离太阳227.9 * 10 ** 6公里,火星公里。

#!/usr/bin/env python                                                             
#  This program solves the 3 Body Problem numerically and plots the trajectories

import pylab
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt
from numpy import linspace

mu = 132712000000  #gravitational parameter
r0 = [-149.6 * 10 ** 6, 0.0, 0.0]
v0 = [29.0, -5.0, 0.0]
dt = np.linspace(0.0, 86400 * 700, 5000)  # time is seconds

我需要将一个JSON数组整理到一个层次结构中,这是我的JSON文件,它从未排序,但遵循以下结构:{ "name":"Folder 2", "id":"zRDg", "parent":"OY00", " ...