#
import matplotlib.pyplot as PLT
import numpy as NUM
#
print('')
print('*** Freier Fall')
print('')
#
# Make Data:
G = 9.81 # [m/s2]
Y0 = 10 # [m]
#
VT = NUM.linspace(0, 1.5, 20)
VV = -G * VT
VY = -G / 2 * VT * VT + Y0
#
# Fallzeit tf [s]
TF = NUM.sqrt(2.0 * Y0 / G)
print('Fallzeit tf = {0} s'.format(TF))
# Fallhoehe yh [m]
YH = Y0
print('Fallhoehe yh = {0} m'.format(YH))
# Aufprallgeschwindigkeit vp [m/s]
VP = NUM.sqrt(2.0 * G * Y0)
print('Aufprallgeschwindigkeit vp = {0} m/s'.format(VP))
#
# Make Plot:
Figure, (Axes1, Axes2) = PLT.subplots(1, 2)
Figure.set_size_inches(12, 8)
#
Axes1.plot(VT, VY, 'b')
Axes1.plot(VT, VY, 'ob')
Axes1.set_title('y(t)')
Axes1.set(xlabel='t [s]', ylabel='y [m]')
Axes1.grid(True)
#
Axes2.plot(VT, VV, 'g')
Axes2.plot(VT, VV, 'go')
Axes2.set_title('v(t)')
Axes2.set(xlabel='t [s]', ylabel='v [m/s]')
Axes2.grid(True)
#
PLT.show()
