Variations on a Theme

Once you understand the basics of producing simple two-dimensional plots, it is easy to produce other kinds of plots to visualize the ballistic trajectory problem. Try a few out on your own before looking at our answers.

Produce a plot showing the horizontal distance traveled by the ball when it is thrown with an initial velocity of 50 meters/sec at an angle of 45 degrees.

Click here for the answer

Now define a function called plotDistance that gives the horizontal distance traveled by the ball as a function of the initial velocity and angle. This function should be very much like plotHeight.

Click here for the answer

In both plotHeight and plotDistance, the time range (0..10) and the height/distance range (0..100)/(0..1000) are ``hard-wired'' into the function definition. Modify plotDistance so that the upper end of both ranges can be specified by the caller.

Click here for the answer


Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah