Objects in motion are part of everyday life, and they occupy much of physics. From there it has found its way into computer visualizations, not the least gaming. In preparation for future posts, this one will discuss some basic aspects of representing motion, and show a simple computer simulation example of an object in motion.
René Descartes was a 17th century philosopher (“I think, therefore I am”), but also scientist and mathematician. Among his many contributions were ideas that led to the 2 axes graphical representation of position we often use today. For this his name is reflected in the formalized Cartesian coordinate system. He is supposedly also responsible for assigning x and y labels to the horizontal and vertical axes, respectively.
The graph below shows a Cartesian coordinates graph. Position representation in the plane is in the form of number pairs \((x, y)
\). The blue spot shown sits at position \((2, 1)\). One way to represent motion is to generalize the single position into a curve. The curve then includes all possible \((x, y)\) positions along the path. The red curve below illustrates a portion of the algebraic function \(y=-1.8+(x+0.2)^2\).
In his last year, Descartes moved to Stockholm to bring new enlightenment ideas to the Queen of Sweden, Christina. But he did not enjoy the climate, neither meteorological nor intellectual. He caught pneumonia and died after only a few months, in February 1650.
Equations of Motion
Descartes’ ideas served as important inspirations for future work on the topic of objects in motion. One major contributor was Isaac Newton, whose laws of motion are sufficiently accurate in most everyday situations. The laws make use of 3 parameters: position, velocity, and acceleration.
Position locates a point relative to some reference point. Velocity is the rate of change of position with respect to time. Similarly, acceleration is the rate of change of velocity with respect to time. Using SI units, position is measured in meter (m), velocity in m/s and acceleration in m/s2.
If you have no previous exposure to the unit of acceleration it might look strange at first sight. But let us look at an example. The acceleration due to gravity is roughly 10 m/s2. This means when something drops it will increase its velocity by 10 m/s per second. So one second after the drop the speed is 10 m/s, after two seconds it is 20 m/s, etc.
According to Newton’s laws of motion, the acceleration of an object is fundamentally determined by the forces acting on it. More specifically, the force \(F\) needed to accelerate (\(a\)) an object of mass \(m\) is \(F=ma\). At the same time, forces can be position or velocity dependent, which may result in complex parameter interdependence.
Comments on Acceleration
The SI unit of acceleration is probably unfamiliar to many people. After all, reading a nature magazine you are more likely to get to know that the cheetah accelerates from zero to 100 km/h in 3 seconds. This information is understandable, but it uses two numbers instead of one and mixes hours with seconds. The more compact SI unit can be found by translating 100 km/h into 28 m/s, and then dividing by 3 seconds to get the acceleration = 9.3 m/s2.
Another thought. Why is it enough to use position, velocity and acceleration to represent objects in motion? Why not continue with the next logical step, the rate of change of acceleration, and so on? This is because forces in nature result in acceleration, making it redundant to continue for almost all situations. There are conceptual continuations in the jerk and jounce. Jounce is sometimes called “snap”, which has led to a somewhat amusing further terminology continuation, the snap, crackle and pop.
Once in a while the equations of motion have analytical solutions, which means we can calculate an exact result. A simple example often used in classical mechanics is the motion of a launched cannon ball making its way back to earth’s surface. In its simplest form, gravity is the only force acting on the ball, and the resulting motion path follows a parabola. If you don’t like cannons, you can imagine a jumping fox instead.
But often the situation is too complex for an analytical solution, and then a computer simulation can be helpful. The result is a numerical solution. The simulation uses a computer algorithm built on fundamental knowledge of the problem. This includes “initial conditions”, which are the starting positions and velocities, as well as the forces (and thus accelerations) acting on the object. There are many algorithms to choose from, but here we use the simplest possible for understanding.
Simple Algorithm For Objects In Motion
The idea is to let the computer calculate the motion path of objects in steps, also known as iteration. The first step follows from the initial conditions mentioned above. The resulting position \((x, y)\) and velocity \((u, v)\) of the first step is then used as input for the next step, and so on. Acceleration due to gravity is constant, at least while staying roughly in place. The value in Sweden is \(a\) = 9.82 m/s2. The iteration uses a fixed time step, which we call \(dt\).
At each step the algorithm updates the parameters accordingly:
x \leftarrow x + v_x dt \\
y \leftarrow y + v_y dt \\
u \leftarrow u \\
v \leftarrow v + a dt
where \(u\) and \(v\) are the horizontal and vertical velocities of the object. Arrows indicate that the calculated value on the right replaces the parameter on the left. The algorithm is an implementation of the Euler method, the most basic numerical approach for solving this type of problems.
Simulating Objects In Motion
Below is a graph showing both analytic and three different numerical results for an object launched at 45º angle, with a velocity of 10 m/s. The analytic result (purple curve) shows what will happen in reality. The blue, red and green dots show numerically calculated positions corresponding to different time steps.
The algorithm assumes that an object continues along a straight path during a single time step. Therefore, a big time step means few directional updates and results in a jagged and too long trajectory. The bigger the time step, the bigger the error. Also, there are more accurate algorithms available, for instance among the commonly used Runge-Kutta methods.
A fun thing with computer simulations is that they often translate well into animations, which can breathe life into the results. The example animation below shows an object launched at 60º angle, at 10 m/s, using a time step of 0.0167 s.