The Ballistic Trajectory Problem

One of the first problems studied in an introductory physics class is the ballistic trajectory problem. Let's assume that we are standing in a flat field and that we throw a ball so that it starts out moving at some velocity V > 0 and at some angle 0 radians with the ground. At any given time t, the ball's horizontal distance is given by

Vt cos(theta)

and its vertical height is given by

Vt sin(theta) - (1/2)gt^2

where g is the earth's gravitational constant, or 9.8 meters/sec/sec. This assumes that the ball's initial horizontal and vertical positions are both 0. It will prove convenient to define functions distance and height that take initial velocity, initial angle, and time as arguments and return the distance and height of the ball. See if you can do that yourself before looking at our solutions.

Click here for the answer


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