import numpy as np
import matplotlib.pyplot as plt

#Liste des instants en jours
temps_jours=[i*84 for i in range(1,9)]
#Liste des distances Soleil-Mars en unité astronomique
r_ua=[1.381,1.430,1.535,1.629,1.666,1.636,1.548,1.441,1.382]
#Liste des angles en degrés
theta_deg=[0,53,100,141,178,215,255,301,354]
#Liste des angles en radians
theta_rad=[theta_deg[i]*np.pi/180 for i in range(len(theta_deg))]

#Liste des x en ua
x_ua=[r_ua[i]*np.cos(theta_rad[i]) for i in range(len(r_ua))]
#Liste des y en ua
y_ua=[r_ua[i]*np.sin(theta_rad[i]) for i in range(len(r_ua))]

# Trajectoire y en fonction de x
plt.plot(x_ua,y_ua)
plt.xlabel("x(t) (ua)")
plt.ylabel("y(t) (ua)")
plt.grid()
plt.axis("equal") # pour obtenir un repère orthonormé
plt.show()

# Liste des aires balayées en ua^2
aire=[r_ua[i]*r_ua[i+1]*np.sin(theta_rad[i+1]-theta_rad[i])/2 for i in range(len(r_ua)-1)]

# Courbe aire en fonction des instants
plt.plot(temps_jours,aire,"+")
plt.xlabel("t (j)")
plt.ylabel("aire (ua^2)")
plt.grid()
plt.axis([0,700,0,1])
plt.show()


