plt.figure('Alpha = {}'.format(alpha)) plt.plot(x, y, 'b-') plt.plot(0, 0, 'yo', ms=20) plt.show() if __name__ == "__main__": t_0 = 0 t_end = 100 h = 1e-4 alpha = geomspace(1e-2, 3e-6, num=50) arcsec_per_year = empty(alpha.shape[0]) r, v, m = empty((1, 2)), empty((1, 2)), empty(2) r[0], v[0], m[0] = get_start_vals('Mercury', -1, 0) m[-1] = 1 r[0, 0] = r[0, 0] * -1 v[0, 1] = v[0, 1] * -1 for iter in range(alpha.shape[0]): t, x, y, v_x, v_y = RK4_exp_static_sun(1, t_0, t_end, r, v, m, h, der_r, get_der_v_einstein(alpha[iter])) r0 = squared(x[0], y[0]) deg = get_angle(x[0], y[0]) round = 0 last_periphelion = 0
path.__delitem__(0) from numpy import array, empty, savez planets = array([ 'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune' ]) if __name__ == '__main__': tau_list = empty(len(planets)) a_list = empty(len(planets)) for p in range(len(planets)): params = get_vals(planets[p]) a_list[p] = params[0] r, v, m = get_start_vals(planets[p], 1, 0) t_start = 0 t_end = 1.2 * params[0]**(3 / 2) h = 10**-4 t, x, y, vx, vy = RK4_exp_static_sun(1, t_start, t_end, array([r]), array([v]), [m, 1], h, der_r, der_v) halfway = False for i in range(len(t)): if ((y[0, i] > 0) and (halfway)): tau = t[i] break elif (y[0, i] < 0) and not (halfway): halfway = True
G = 4 * pi**2 def squared(x, y): return sqrt(x**2 + y**2) if __name__ == "__main__": t_0, t_end = 0, 100 h = 1e-4 N_OBJECTS = 2 m = empty(N_OBJECTS + 1) r = empty((N_OBJECTS, 2)) v = empty((N_OBJECTS, 2)) r[0], v[0], m[0] = get_start_vals('Earth', 1, 0) r[1], v[1], m[1] = get_start_vals('Mars', -1, 0) m[-1] = 1 #m[1] = 317.89 / 333480 #m[0] = 317.89 / 333480 m[0] = m[-1] t, x, y, v_x, v_y = LG4_imp_static_sun(N_OBJECTS, t_0, t_end, r, v, m, h, der_r, der_v, der_v_der_primary, der_v_der_secondary) fig1 = plt.figure('Figur r') plt.rc('xtick', labelsize=22) plt.rc('ytick', labelsize=22) gs = grd.GridSpec(1, 1)
path.__delitem__(0) from numpy import array, pi, empty, abs, sqrt, savez from matplotlib import pyplot as plt if __name__=="__main__": t_0, t_end = 0, 500 h = 1e-3 N_OBJECTS = 9 m = empty(N_OBJECTS) r = empty((N_OBJECTS, 2)) v = empty((N_OBJECTS, 2)) r[0], v[0], m[0] = array([0, 0]), array([1.7e-3, -9e-4]), 1 #r[0], v[0], m[0] = array([0, 0]), array([0, 0]), 1 r[1], v[1], m[1] = get_start_vals('Mercury', 0, 0) r[2], v[2], m[2] = get_start_vals('Venus', -1, 0) r[3], v[3], m[3] = get_start_vals('Earth', 1, 0) r[4], v[4], m[4] = get_start_vals('Mars', 0, 0) r[5], v[5], m[5] = get_start_vals('Jupiter', 0.5, 0) r[6], v[6], m[6] = get_start_vals('Saturn', -0.5, 0) r[7], v[7], m[7] = get_start_vals('Uranus', 1, 0) r[8], v[8], m[8] = get_start_vals('Neptune', -1, 0) r[4, 1], v[4, 0] = r[4, 1]*-1, v[4, 0]*-1 r[6, 1], v[6, 0] = r[6, 1]*-1, v[6, 0]*-1 #m[3] = 317.89/333480 #print (m[3])
path.__delitem__(0) from numpy import array, pi, empty, abs, sqrt, savez from matplotlib import pyplot as plt if __name__ == "__main__": N_OBJECTS = 1 t_0, t_end = 0, 50 h = 1e-3 m = empty(3) r = empty((N_OBJECTS, 2)) v = empty((N_OBJECTS, 2)) r[0], v[0], m[0] = get_start_vals('Earth', 1, 0) #r[1], v[1], m[1] = get_start_vals('Mars', -1, 0) #r[2, 0], r[2, 1] = 0, 0 #v[2, 0], v[2, 1] = 0, 0 m[-1] = 1 #m[0] = 1e-3 print(m) print(r) print(v) t, x, y, v_x, v_y = LG4_imp_static_sun(N_OBJECTS, t_0, t_end, r, v, m, h, der_r, der_v, der_v_der_primary, der_v_der_secondary)
from numpy import array, empty from matplotlib import pyplot as plt import matplotlib.gridspec as grd if __name__ == "__main__": t_0, t_end = 0, 500 h = 1e-4 N_OBJECTS = 5 m = empty(N_OBJECTS) r = empty((N_OBJECTS, 2)) v = empty((N_OBJECTS, 2)) r[0], v[0], m[0] = array([-0.00190482984382 / 2, 0]), array([-2.8e-7, -5.865e-3]), 1 r[1], v[1], m[1] = get_start_vals('Mercury', 0, 0) r[2], v[2], m[2] = get_start_vals('Venus', -1, 0) r[3], v[3], m[3] = get_start_vals('Earth', 1, 0) r[4], v[4], m[4] = get_start_vals('Mars', 0, 0) r[4, 1], v[4, 0] = r[4, 1] * -1, v[4, 0] * -1 m[3] = 317.89 / 333480 print(m[3]) t, x, y, v_x, v_y = RK4_exp( N_OBJECTS, t_0, t_end, r, v, m, h, der_r, der_v) #, der_v_der_primary, der_v_der_secondary) print(max(v_x[0])) print("Non-static sun")