## Modules

import numpy as np
import matplotlib.pyplot as plt
from math import sin


## Constantes

omega0 = 1 # pulsation propre

## Fonctions

def F(X: np.array, t: float) -> np.array :
    global omega0
    return ...


def Euler(X0: np.array, F: callable, T: float, n: int) -> tuple:
    ...
    return t, theta


## Tests
X0 = np.array([...]) # conditions initiales


T = 20  # durée en s
n = 100000 #nb de points

t, theta = Euler(X0, F, T, n)

plt.close('all')
plt.figure(...)
plt.plot(...)
plt.xlabel(...)
plt.ylabel(...)
plt.show()

## Perte d'isochronisme

theta0 = [...]
periode = [...]

plt.close('all')
plt.figure(...)
plt.plot(...)
plt.xlabel('amplitude (rad)')
plt.ylabel('période (s)')
plt.show()

## Explosion !
X0 = np.array([0.1, 0])
T = 1000
n = 100000

...


#### Fonction odient

from scipy.integrate import odeint


# Durée de la simulation
T = 800
# Nombre de points
n = 100000
# Liste des instants
t = np.linspace(0, T, n)
# Conditions initiales
X0 = np.array([0.1, 0])
# Résolution numérique
sol = odeint(F, X0 , t)


theta = sol[:, 0]

# Tracé des graphes

plt.close('all')
plt.figure()
plt.plot(t, theta)
plt.xlabel(r'$t \, {\rm (s)}$ ')
plt.ylabel(r'$\theta \, { \rm(rad)}$')
plt.grid()
plt.show()



