Now let's consider the problem of visualizing the complete trajectory followed
by a ball that is thrown with a particular velocity and angle. One idea is to
put both the height and the distance on the same plot.
| plot({height(50, Pi/4, `time (sec)`),
distance(50, Pi/4, `time (sec)`)},
`time (sec)`=0..10); |
Given such a plot, it is possible to read off the distance/height coordinates
of the ball for any given time either by ``eyeballing'' the two curves or
clicking on the curves with the mouse to obtain more exact coordinates. But
this still isn't what we really want, which is the exact trajectory.
Fortunately, we can do even better. Here is how we can get a plot of the
trajectory followed by the ball:
| plot([distance(50, Pi/4, t),
height(50, Pi/4, t),
t=0..10]); |
This is called a parametric plot: a plot with one independent variable
(time, in this case) and two dependent variables (distance and height, in this
case) in which the independent variable is not explicitly graphed. The
curve shows the trajectory followed by the ball as time ranges from 0 to 10
seconds, but time does not appear on either of the axes of the plot.
Just as with normal two-dimensional plots, we can constrain and label the axes:
| plot([distance(50, Pi/4, t),
height(50, Pi/4, t),
t=0..10],
`distance (meters)`=0..300,
`height (meters)`=0..100); |
The idea behind a parametric plot works even when the independent variable is
something other than time. For example, let's look at the distance and height
reached after 5 seconds, by a ball thrown at 50 meters/sec, for all possible
angles.
| plot([distance(50, theta, 5),
height(50, theta, 5),
theta=0..Pi/2]); |
The result doesn't give a trajectory followed by any ball, but it does show the
effects of modifying the initial angle. Unfortunately, it is a little hard to
tell what angles correspond to which points on the curve unless you already
understand a little bit about the ballistic trajectory problem.
Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah