Dynamics

This is Isaac Newton


The Laws Of Motion

In 1687, he published his famous 3 laws of motion:

1. Every body persists in its state of rest or of uniform
straight motion, unless acted upon by an outside force.

2. The alteration of motion is proportional to the force
 and is made in the direction of the applied force.

3. CLASSIFIED

The Law




F = ma



That's it!

This is Richard Feynman


Definitions tell us nothing!


The Newtonian statement above [F=ma] ...
is completely useless, because no prediction
whatsoever can be made from a definition.

One might sit in an armchair all day long and define
words at will, but to find out what happens when two
balls push against each other, or when a weight is hung
on a spring, is another matter altogether, because the
way the bodies behave is something completely
outside any choice of definitions.

The Laws Of Gorce?


If we were to choose to say that an object left to itself keeps
its position and does not move, then when we see something drifting, we could say that must be due to a “gorce”—
a gorce is the rate of change of position.

Now we have a wonderful new law, everything
stands still except when a gorce is acting.

You see, that would be analogous to the above definition
of force, and it would contain no information.

This is The Doctor

(back in the 1980s, when he was a fan of cricket)


...illustrating The 3rd Law


"To every action there is always opposed an equal reaction:
or the mutual actions of two bodies upon each other are always equal, and directed to contrary parts"


So, if you ever find yourself trapped in deep space,
halfway between an alien ship and your TARDIS...

...throw away that stupid cricket ball!

Falling Objects

If you drop a 1kg weight and a 2kg weight,
how much faster does the 2kg weight fall?

(see around 15:00 - 16:30)

Gravity


This says that every object in the universe is "magically" attracted to every other object in the universe,
instantaneously, and without limit of distance.


This is really weird.

(Also, it's not entirely accurate.)

Gravity Near Earth


Objects near the surface of the Earth
all have fairly similar values of "r squared"
and the Earth is massive enough to make the
influence of other bodies relatively negligible.


That's why we can approximate things down to:

F = mg

Where 'g' is Earth's local gravity "magic number"

Calculate It!


G = 6.67 x 10 -11    ( m 3 kg -1 s -2)
M e = 6 x 10 24      (kg)
r = 6.4 x 10 6     (m)


g = GM e/r 2 =
(6.67 x 6 x 1013) /
(6.4 x 6.4 x 1012


= 9.77 (The correct value is actually 9.81)

Other Mysterious Forces


Summary


Forces are applied to bodies. The origin of the forces is not specified, but they usually arise from body-to-body interactions such as contact, collision or gravitation.

These forces add together (as vector sums) and cause the bodies to accelerate (in inverse proportion to their masses).

Acceleration is the change in velocity with respect to time.
Velocity is the change in position with respect to time.

Velocity-Time graphs

Such graphs provide an excellent way of
understanding the situation e.g.
 
(Felix Baumgartner's 2012 "Space Dive")

Computing Displacements


In physics we often talk about "displacements" as being the vector form of total "distances" (accounting for directions).

So, displacements just define positions, and that is what we ultimately care about, because that is what we can see.

We can't directly see a velocity, or an acceleration, but can
only infer them from their eventual effects on a position.

Displacement is the integral (sum) of velocity wrt time.
i.e. it is the "area under the curve" of a vel-t graph.

Numerical Integration




Smaller steps give more accurate approximations.
(And using averages across each step is even better).

Mid-Point Integration




Midpoints generally provide a better approximation
than relying purely on either of the end points. 

Uniform Acceleration

(e.g. what gravity provides, near a 'big' planet)

Actually very easy! (and is what we usually assume)

Algebraically


We can perform this "integration" with a discrete numerical approximation i.e. by adding it all up in little pieces,
for small increments of time, called "dt"...

pos = pos + average_v * dt
average_v = (initial_v + final_v) / 2
final_v = initial_v + accel * dt
accel = force / mass
force = sum of all forces acting on this body

We can calculate these terms in backwards order.

Kids Can Do This

...with the help of computer simulations

...which they write themselves (16:30 - 19:00)



Homework Pt 2.


Simulate a thrust-driven spaceship sprite,
which can rotate freely in space (by, erm, "magic")

Provide a toggle for gravity, and implement bouncing collision with the top and bottom of the playfield when gravity is active, otherwise implement standard
wrap-around positional behaviour.

Also provide two "extra" ships, which imitate the primary one, but use update deltaTimes of half and quarter the size.

Framework


Spaceship

NB: The mouse-button handling of this framework doesn't seem to work correctly in Firefox. I must have wandered into some grim, ugly, browser-specific behaviour. So use Chrome!

It seems to be related to browser-inconsistencies with
evt.button and evt.which (etc.) on mouse-click events:
http://www.quirksmode.org/js/events_properties.html

JavaScript


JavaScript isn't an ideal language for performing
computations on vector quantities...

Although it allows "user defined types" (objects), and provides native arrays (a good fit for vector quantities), it doesn't support operator-overloading, and has weak support for copying and comparing "object" types.

As such, I've found it best to implement "vectors" using "scalar" numeric types i.e. with explicit, and separate,
'x' and 'y' values for each component.