""" Exercise 5.10 from "A primer on..." Extend the previous exercise to read several v0 values from the command line and plot the corresponding curves in the same window. We need a foor loop iterating over the provided v0 values, and place all the plotting commands inside the for loop. """ import numpy as np import matplotlib.pyplot as plt import sys g = 9.81 v0_list = sys.argv[1:] for v0 in v0_list: v0 = float(v0) #a new t array is needed for each plot: t_max = 2 * v0 / g t = np.linspace(0, t_max, 101) y = v0 * t - 0.5 * g * t**2 plt.plot(t, y) plt.xlabel('time (s)') plt.ylabel('height (m)') plt.show()