In a computer simulation you must break both time and space into
finite, discrete pieces. This typically results in tension between
precision and performance.
Ideally, you would make the time and space units extremely small
so as to best represent the continuity of the physical world and
to reduce the build up of mathematical errors. On the other hand,
the fewer the number of units to deal with, the less memory the
program requires and the faster the program will run.
The optimum size for the time and space units will clearly depend
on the particular simulation and the equations involved. In fact,
as we will see in a later discussion dealing
with time in a simulation, different parts of the simulation
might use different scaling.
For example, the frame rate of an animation would typically involve
a considerably longer time period than those of the time increments
in an integration of a differential equation that calculates the
motion of an object over the time period of that frame. Otherwise,
a coarse increment could result in a highly inaccurate integration
in the case where the function varies significantly at the scale
of the increment.
Obviously, the platform(s) on which you plan to run the program
also can affect what scale of units to use. This is especially
significant
for animations. One powerful machine might easily complete the
calculations required before it displays a new frame, while a
less powerful machine
might occasionally fail to complete the calculations on time and
cause flickering in the animation. (Animation frames could be
saved for later playback as in a video but here we are discussing
real-time interactive animations.)
Below we show a simple animation of a projectile. For the given
initial location, velocity, and angle, it should hit at the spot
indicated. The slider allows the user to vary the dtcalc
value used in the numerical integration of the
equation of motion for each frame.
|