# Simulating Motion – Part 1

In previous posts we have discussed how animations and games are simulations of the real world. For these simulations to be authentic, the objects in them have to move realistically and thus they must obey the laws of Physics. Of course, you may want your game or animation to have different physical laws. But even then, you have to understand the laws in order to break them in a plausible way.

In this post we’ll discuss the fundamental concepts needed to analyse the motion of macroscopic objects. These concepts are valid whether we want to simulate motion on a computer or consider it in real life.  Fundamentally, we are looking at how to translate a physical phenomenon or situation into a mathematical model that we in turn want to convert into a working computer program. In a follow up post, we’ll discuss how to solve the mathematical model we obtain and how we use this information in a game or animation.

## Kinematics – describing the motion

We mentioned physical laws earlier, and the ones that interest us here are Newton’s laws of motion, particularly the second law. It relates the forces acting on an object to its motion. When we analyse the motion of, say, a ball, we want to predict the motion of the ball as time passes, given we know the forces acting on it. However, let’s take one step back here. Describing the motion of an object involves answering the following questions:

• Where is the object? This gives us the position.
• Is it moving? If yes, how fast and in what direction? This is the velocity.
• Is it speeding up, slowing down or changing direction? This is acceleration.

You’ll notice that these are actually very intuitive questions to ask when thinking about an object’s motion. The important point to grasp here is that we can relate the three quantities, position, velocity and acceleration to each other.  The mathematical tool we use to do this is calculus. Thinking about it in these everyday terms, most of us already have an intuitive idea of what calculus is  – most of us are familiar with the questions above, even though we may not know the mathematics to describe it.

To answer the question of where an object is, one always needs a reference point. Even in everyday life, when we specify positions of objects, we assume someone else has a reference point. For example you might say “It’s the plant on the left of the front door as you face the house”, or some other such description. Implicit in that description is the assumption that the other person knows where the front door is (and, of course, that they can distinguish left from right). The same principle applies to mathematical descriptions of motion. We need a reference frame relative to which we can uniquely specify the positions of objects. Most of us are probably familiar with the fact that in 1 dimension we need one number (often denoted as a coordinate on the $x$ axis) to uniquely specify a point, in 2 dimensions we need two numbers (coordinates on the $x$ and $y$ axes), etc. For the rest of this post, we’ll only consider one dimensional motion (things moving in straight lines) simply because it is easier to grasp the fundamental concepts without the complications of two or three dimensions.

### Position and velocity

If an object moves, its position is changing and the velocity tells us how quickly (the rate) the position is changing and in which direction the object is moving. To make things quantitative, we first choose a fixed time interval, $\Delta t$, and ask how much the position of the object has changed in that time. The greater the distance covered in that fixed time interval, the faster the object is moving. If the object moved from point A to point B in that time interval, we express the speed as $$\textrm{speed} = \frac{\textrm{change in position}}{\textrm{time interval}}$$ or equivalently  $$v = \frac{x_{B} – x_{A}}{\Delta t}$$ where $x_{A}$ and $x_{B}$ are the positions of the object at points $A$ and $B$ respectively.

The idea is to make the time interval $\Delta t$ as small as possible, so that we can obtain a more accurate estimate of the speed at successive fixed times. In calculus, we let the time interval approach zero and we write the equation for the speed as $$v = \frac{dx}{dt}.$$ Of course, we’re glossing over some mathematical details here. However, the main point is not mathematical rigour, but rather to develop an understanding of the concepts.

The speed is the magnitude of the velocity, but we still need a convention to indicate the direction of motion. For the one dimensional systems we are considering at the moment, the object can move, say, left or right. We use the convention that the object is moving to the right if the velocity is positive and to the left if it is negative. For a more complete description, we need the concept of vectors, but we’ll not delve into that here.

### Velocity and acceleration

In exactly the same manner, we can make the connection between velocity and acceleration. During the same fixed time interval, $\Delta t$ we now ask whether the object’s speed is changing. So we would be interested in calculating the following quantity: $$\textrm{acceleration} = \frac{\textrm{change in velocity}}{\textrm{time interval}},$$  or equivalently  $$a = \frac{v_{B} – v_{A}}{\Delta t} ,$$ where $v_{A}$ and $v_{B}$ are the velocities of the object at points $A$ and $B$ respectively. Again, letting the time interval approach zero, we would write this as $$a = \frac{dv}{dt}.$$

If we use the two relations for position-velocity and velocity-acceleration, we can also make the connection between position and acceleration as follows $$a = \frac{dv}{dt} = \frac{d}{dt}\left( \frac{dx}{dt} \right) = \frac{d^{2} x}{dt^{2}}.$$

In everyday language, we associate the word acceleration with objects speeding up. In Physics, acceleration simply means a change in the velocity. It includes speeding up, slowing down and a change in direction of the object. As in the case of velocity, we use the convention that the acceleration is positive if it is to the right, and negative to the left. This is consistent since if the velocity is to the right and the acceleration is also to the right, the object speeds up. If the acceleration is to the left, the object in this case would slow down. The same reasoning, of course, applies to the object moving to the left.

## Dynamics – understanding the motion

Now that we know how to describe the motion of objects, we need to make the connection to the forces acting on the object. Newton’s second law of motion provides us with the connection. It states that an object will experience an acceleration (speed up, slow down, or change direction) if it experiences a nett force. Mathematically, we write this as $$a = \frac{1}{m} F_{nett},$$ where m is the mass of the object and $F_{nett}$ is the nett force on the object. Newton’s second law is usually written as $F_{nett} = ma$, but the form above makes the cause (force) – effect (acceleration) relation much clearer.  We see that the greater the nett force on an object, the greater its acceleration will be. If the same force is applied to two objects, the heavier one will experience a smaller acceleration.

The acceleration and the nett force point in the same direction. If we now consider the last paragraph of the previous section again, we can see it makes even more sense. If the force points in the direction opposite to the motion, it slows the object down, and vice versa.

To determine the nett force, we have to identify all the individual forces acting on the object and then add them together. This is probably the most important step in modelling the dynamics because it contains our assumptions of what we consider as the important forces acting on the object. One could say that this is the step where “the physics happens”.

If we now put all of the above together and “translate” it using calculus, Newton’s second law of motion is $$\frac{d^{2} x}{dt^{2}} = \frac{dv}{dt} = \frac{1}{m} F_{nett}.$$ This is a differential equation and solving it means we determine $x$ as time passes, and thus are able to predict the motion of the ball.

Of course, we still have to solve the differential equation and it may not always be possible to solve it exactly or even in a nice closed form. We then have to resort to solving it numerically on a computer. But this is exactly what we have to do if we want to simulate real objects in games or animations. In a follow up post, we’ll consider the basics of that process by considering the motion of a falling ball, something we can solve exactly, and then comparing the numerical results with exact results.