/* Trajectory_ballistic */ /* launch velocity: 305 metres */ /* launch altitude: 1.3 metres */ /* launch angle: 5 degrees */ /* angle of a straight line: constant 180 degrees */ /* acceleration of gravity: constant 9.8 metres/second^2 */ SolveTime : solve(1.3+305*sin(5/180*%pi)*t-4.9*t^2 = 0, t)$ tMaxDist : subst(last(SolveTime),t)$ /* time to altitude 0 */ MaxDistance : [305*cos(5/180*%pi)*tMaxDist, 1.3+305*sin(5/180*%pi)*tMaxDist-4.9*tMaxDist^2]$ tMaxHeight : 305*sin(5/180*%pi)/9.8$ /* time to maximum altitude */ MaxHeight : [305*cos(5/180*%pi)*tMaxHeight, 1.3+305*sin(5/180*%pi)*tMaxHeight-4.9*tMaxHeight^2]$ load('draw)$ draw2d(xlabel="distance (m)", ylabel="height (m)", yrange = [-.1*MaxHeight[2], MaxHeight[2]/.85], dimensions=[1024, 768], parametric(305*cos(5/180*%pi)*t, 1.3+305*sin(5/180*%pi)*t-4.9*t^2, t, 0, tMaxDist), color=red, label([sconcat(ev(round(MaxHeight[2]*100)/100, numer=true)), MaxHeight[1], MaxHeight[2]+2]), points([MaxHeight[1]],[MaxHeight[2]]), color=green, label([sconcat(ev(round(MaxDistance[1]*100)/100, numer=true)), MaxDistance[1], MaxDistance[2]-2]), points([MaxDistance[1]],[MaxDistance[2]]) );