# -*- coding: utf-8 -*-
"""
Created on Sun Mar 21 17:52:03 2021

@author: physalp
CALCUL NUMERIQUE DE L'ALTITUDE (ET DE LA VITESSE) D'UN OBJET EN CHUTE LIBRE
"""


import matplotlib.pyplot as plt


g= 9.8 #m.s-2
vx,vz= 0,0#m/s
x,x0=0,0 #m
z,z0=4000,4000 #m
tau=1
xlist=[]
zlist=[]
t=0

i=0
while z>=0:
    x = x+vx*tau
    z = z+vz*tau
    t = t+tau
    vz = vz-g*tau
    xlist.append(round(x, 2))
    zlist.append(round(z, 2))
    i+=1
    
#Affichage de la courbe
plt.title("Simulation d'une chute libre")
plt.xlabel("position x")
plt.ylabel("position z")
plt.plot(xlist, zlist, 'b.')
plt.show()

print("hauteur du parachutiste en mètre toutes les secondes :" )
del zlist[0]
del zlist[-1]
print(zlist)
del xlist[0]
del xlist[-1]
print(xlist)