The physics
When the acceleration changes, v = u + at no longer works. Use areas instead.
v = ∫ a dt (area under a–t) x = ∫ v dt (area under v–t)
Sometimes a depends on x or on v. Then use the chain rule:
a = dv/dt = v · dv/dx
For example, a = −kv gives dv/dx = −k. So a car moving at v₀ stops after v₀/k metres.