Skip to content

1. Simulating Motion

John Nguyen edited this page Feb 10, 2019 · 1 revision

A simulation is a sequence of discrete steps, where each step calculates the movement of a finite collection of objects. If the result of the simulation is a video, you can think of steps as frames.

At the heart of the simulation is the Body. It has a position, a velocity, and a mass.

  • The position describes the body’s location in space.
  • The velocity describes the direction and speed of the body's motion in space.
  • The mass describes the body's gravitational strength as well as its resistance to acceleration.

The position of a body is simple enough, but how exactly does velocity describe motion? First consider a body no velocity. A body with zero velocity has no motion, so it will remain stationary at its position.

If however, the velocity is (5, -8), then in each step of the simulation, the body will move 5 points in the x direction, and -8 points in the y direction. If the velocity doesn't change, then the body will move in a straight line. If it is augmented just once (by a force), then it will change speed and direction and continue in a straight line. If it is continuously augmented, it will move about in curves.

The rate of change of a body’s velocity is called its acceleration. So what can change a body’s velocity? A Force. In this project, we’re only concerned with gravitational force.

“Newton’s law of universal gravitation states that every particle attracts every other particle in the universe with a force which is directly proportional to the product of their masses and inversely proportional to the square of the distance between their centers.”

Gravitational force is a relationship between two bodies. As such, it can be thought of as a formula that accepts two bodies, and returns a vector indicating the change of velocity of the first body.

(Newton’s formula)

Here is where the mass of a body becomes important. The strength of the gravity is dependent on two things: 1) the mass of the bodies, and 2) the distance between their centers. The larger the mass, the higher the gravitational force. The further the bodies, the weaker the gravitational force.

Note that between two bodies, the force exerted upon one another is equal in magnitude, but opposite in direction. (Newton’s third law).

Example.

Now that we can calculate the force vector, what do we do with it? Remember, forces accelerate bodies, so we need to calculate the acceleration. This is given by the formula F = ma. (Newton’s second law) Consequently, a = F/m. Remember before that we said the mass determines a body’s resistance to acceleration? This is evident here. The larger the mass, the smaller the acceleration.

Given the acceleration, how do we apply it to the velocity? Remember acceleration is the rate of change, which means that we simply add the acceleration to the velocity.

Clone this wiki locally