-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
59 lines (51 loc) · 2.25 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
Created at 1/12/16
__authors__ = 'Sergio Padilla / Marina Estévez / Irene Ocaña'
"""
from Utils import get_planets_list
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
if __name__ == '__main__':
planets = get_planets_list()
axis_x = []
axis_y = []
axis_z = []
fig = plt.figure()
ax = fig.gca(projection='3d')
print("Introduce el tiempo (en días terrestres): ")
t = int(input())
for planet in planets:
position = planet.get_pos_newton_raphson(t)
print(' *************************************************** ')
print(planet.name)
print(' *************************************************** ')
print('La posición del planeta es: ', position)
print('Momento angular con Newton-Raphson: ', planet.angular_moment_newton_raphson(t))
print('Momento angular con Bessel: ', planet.angular_moment_bessel(t))
print('Anomalía (u) con Newton-Raphson: ', planet.get_u_newton_raphson(t))
print('Anomalía (u) con Bessel: ', planet.get_u_bessel(t))
print('Distancia al Sol con Newton-Raphson: ', planet.distance_sun_newton_raphson(t))
print('Distancia al Sol con Bessel: ', planet.distance_sun_bessel(t))
print('Área Newton-Raphson (tiempo inicial: 0, tiempo final: t): ', planet.area_newton_raphson(0, t))
print('Área Bessel (tiempo inicial: 0, tiempo final: t): ', planet.area_bessel(0, t))
print('Energía: ', planet.energy(planet.get_u_newton_raphson(t)))
print('Energía teórica: ', planet.th_energy())
for i in range(0, int(planet.period+1)+10):
position = planet.get_pos_newton_raphson(i)
axis_x.append(position[0])
axis_y.append(position[1])
axis_z.append(position[2])
ax.plot(axis_x, axis_y, axis_z)
ax.scatter(position[0], position[1], position[2])
ax.scatter(position[0], position[1], position[2], s=8 ** 2, c='k', alpha=0.5)
ax.scatter(0, 0, s=10 ** 2, c='y', marker='*')
ax.scatter(0, 0, s=11 ** 2, c='y', alpha=0.5)
axis_x = []
axis_y = []
axis_z = []
ax.set_xlim3d(-30, 30)
ax.set_ylim3d(-30, 30)
ax.set_zlim3d(-30, 30)
plt.show()
print(5 ** 2 * 2)
print(2 * 5 ** 2)