Parabole

#Conditions initiales:

x = 0.

y = 2.

vx = 3.5

vy = 0.

ax = 0.

ay = -9.81

t = 0.

#pas de temps

dt = 0.001

#Simulation

while y > 0. :

x = x + vx * dt

y = y + vy * dt

vx = vx + ax * dt

vy = vy + ay * dt

t = t + dt

print(“La balle touche le sol à t =”, t, “s et à la position x =”, x, “m”)

donne

La balle touche le sol à t = 0.6400000000000005 s et à la position x = 2.2399999999999984 m