import numpy as np import matplotlib.pyplot as plt v0 = 5. y0 = 3. a = -9.81 p = [a/2, v0, y0] t_max = np.roots(p) t = np.linspace(0, t_max[0], 1000) v = a * t +v0 y = a * t**2/2. + v0*t + y0 plt.figure() plt.subplot(3,1,1) plt.title("Mouvement de la Balle") plt.plot(t, y, 'b') plt.xlabel('') plt.ylabel("position (m)") plt.xlim(np.min(t), np.max(t)) plt.ylim(0, 1.1 * np.max(y)) plt.subplot(3,1,2) plt.plot(t, v, 'g') plt.hlines(0,np.min(t), np.max(t)) plt.xlabel('') plt.ylabel("vitesse (m/s)") plt.xlim(np.min(t), np.max(t)) plt.subplot(3,1,3) plt.hlines(a, np.min(t), np.max(t), 'r') plt.xlabel('temps (s)') plt.ylabel("accélération (m/s²)") plt.xlim(np.min(t), np.max(t)) plt.show()