import numpy as np
import matplotlib.pyplot as plt

#grandeur caractéristiques

m = 0.1
g = 9.8
w= 10
R= 0.2

theta = np.linspace(0,2*np.pi, 1000) # discrétisation de l'angle (début, fin, nombre de termes)

Ep = m*g*R*(1-np.cos(theta))-0.5*m*w**2*R**2*(1+np.sin(theta))**2+0.5*m*w**2*R**2
#Ep = m*g*R*(1-np.cos(theta))
#Ep=0.5*m*w**2*R**2*(1+np.sin(theta))**2-0.5*m*w**2*R**2
# Tracé du graphique
font = {'family': 'serif',
        'color':  'darkred',
        'weight': 'normal',
        'size': 16,
        }
      
plt.plot(theta,Ep) # on trace la colonne 0 donc u(t)


#plt.legend((l1), ('$R=4,70 \ k\Omega$', '$R=1,00 \ k\Omega$', '$R=420 \ \Omega$'), loc='upper right', shadow=True)
plt.xlabel('$\Theta$ ', fontdict=font)
plt.ylabel('$E_p$ (J)', fontdict=font)
plt.ylim(Ep.min()*1.1,Ep.max()*1.1)    # permet de fixer le max et le min de l'échelle selon y.
plt.title('Énergie potentielle de la sphère', fontdict=font)
plt.grid(True)

