# ball_trajectory.py
# This function predicts a balls hypothetical projectory
# where x is the horizontal position, and default horizontal
# speed is 0.99 meters per second and initial vertical speed
# is 9.9 meters per second
# by Scott Gordon
import matplotlib.pyplot as plt
def ball_trajectory(x):
location = 10*x - 5*(x**2)
return location
# Plot the hypothetical ball trajectory between moment it is
# thrown (x = 0) and when it hits ground (x = 2)
xs = [x/100 for x in list(range(201))]
ys = [ball_trajectory(x) for x in xs]
plt.plot(xs, ys)
plt.title('The Trajectory of a Thrown Ball')
plt.xlabel('Horizontal Position of Ball')
plt.ylabel('Vertical Position of Ball')
plt.axhline(y=0)
plt.show()
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)