#exer 5.11 from numpy import * from matplotlib.pyplot import * import sys #v0 = 10 g = 9.81 v_list = sys.argv[1:] t_max = 0 y_max = 0 for v0 in v_list: v0 = float(v0) t_stop = 2*v0/g t = linspace(0,t_stop,100) y = v0*t-0.5*g*t**2 plot(t,y,label = 'v0 = %g' %(v0)) #update the maximum values for each iteration: if t_stop >t_max: t_max = t_stop if max(y) > y_max: y_max = max(y) xlabel("time (s)") ylabel("height (m)") axis([0, t_max, 0, y_max*1.1]) legend() show() """ Terminal> python plot_ball2.py 3 5 6 (output is a plot) """