# -*- coding: utf-8 -*-
"""
Created on Sat Feb 21 17:36:15 2026

@author: erwan
"""
import numpy as np
import matplotlib.pyplot as plt

#Mesures
h = np.array( [0] ) #Hauteur d'eau au dessus du trou en m
incertitude_h = 0  #Incertitude sur la hauteur d'eau en m
L = np.array( [0] ) #Portée du jet jusqu'au sol en m
incertitude_L = 0 #Incertitude sur la la portée en m
H = 0 #Hauteur du trou par rapport au sol en m

L_carré = L #À corriger


#Ajustement
a, b = np.polyfit(h, L_carré, 1)


#Affichage figure
plt.figure(1)
plt.plot(h, L_carré, "or", label="Mesures")
plt.errorbar(h, L_carré, xerr = incertitude_h, yerr = incertitude_L, capsize = 8,
  ecolor = 'red', marker = 'o', markersize = 8, markerfacecolor = 'red', linestyle = 'none')
plt.plot(h, h*a+b, 'b', label="ajustement")
plt.xlabel("Hauteur d'eau au-dessus du trou $h$ (m)")
plt.ylabel(r"$L^2$ (m$^2$)")
plt.title("Vérification de $L^2 = 4Hh$")

plt.grid()
plt.legend()
plt.show()