Sitting in traffic in the middle of London gives you a lot of time to think. Here’s a fun problem born entirely of frustration sat waiting to cross the Hammersmith bridge.
Let’s play a thought experiment. You, dear reader, are a highways technician tasked with installing a new speed bump on a road near your house. Your boss has given you a precise volume of concrete to use, but you know you’ll be going over this bump often enough that it will be a problem. Given your load of concrete, what shape should you make the speed bump to minimise your misery?
Let’s break it down. You’re in a car going at horizontal speed , and you hit a speed bump of width and cross-sectional area . The shape of the bump is described as a function – see the diagram below:
Some things we can deduce – your speed at any point is determined by the shape of the curve . By conservation of energy, . Therefore we have
If we also assume that the car wheel stays stuck to the speed bump, then the angle your velocity vector makes with respect to the ground at any point is given by
and the velocity in the and directions is
With these ground rules laid down, let’s turn to what we should be optimising for. The thing that makes speed bumps unpleasant is the amount of vertical acceleration – that’s the jolt you feel as you go over one.
We’d like to minimise acceleration in the direction, over the time we travel over the bump. A mathematically nice way to minimise the absolute value of a function is to minimise the square of the function, i.e. what we want to calculate is
and then minimise it.
The problem is that we don’t have , we have , so there’s a bit of rearranging to do.
Note that the time it takes the car to move horizontally is . Then the vertical acceleration is
Using the shorthand , we have
You might be thinking that this isn’t a particularly elegant looking formula to work with, and you’d be absolutely right. To continue with the analytical effort (as opposed to numerical – see later), let’s start approximating.
First, most speed bumps satisfy , i.e. most cars are going fast enough that they don’t slow down much due to the change in height going over the bump. We can therefore set
Secondly, the slope of the bump will be assumed to be weak so – this effectively means that we will approximate .
Plugging these assumptions through, and converting the integral over time into one over position, we end up trying to minimise the following integral:
The mathematically astute amongst you will realise that the trivial solution is to have , or the speed bump taking the form of a straight line. This is indeed a solution, as the vertical acceleration is zero at all times. If we add the boundary conditions that , then the solution is no speed bump at all! In this case the highways technician would achieve their goal, but probably get sacked in the process.
Of course, we’ve forgotten to include the fact that the cross-sectional area of the speed bump needs to stay fixed, or
This is a constraint on the minimisation problem, and must be included.
The generic way to include such constraints is to minimise a linear combination of the problem and constraint, i.e. we should minimise
where is an arbitrary constant which we would later adjust to enforce the area constraint.
To actually do the minimisation, note that the end points of the integral are fixed, and the solution we are trying to find is a simple scalar function of the integration variable, in which case the answer comes from the Euler-Lagrange formula. Writing the integral as
the solution is given by
or explicitly in this case
This is pleasingly simple! The general solution is a 4th-order polynomial
which we need to apply some boundary conditions to to find.
Firstly, let’s make the speed bump symmetric, so the odd powers disappear.
Secondly, let’s enforce that , and also .
Finally, let’s make the area under the curve from to A.
Then the solution is
While it is always very pleasing to come up with a simple analytical solution to a problem, we should remember that this is only an approximation. Is it possible to do better than this going beyond pen and paper?
I had a decent go at this, writing a gradient-descent optimiser which started with the analytic shape and optimised according to the exact equations above. The results were… not very different. You can see below that the optimal shape is slightly flatter at the edges and slightly taller overall, but otherwise very close to the solution we already found.
Being a numerical method, it is simple to change some of the other assumptions above. What if we minimise the integral of rather than ? As you see below, this results in a slightly wider and shorter speedbump, but overall rather similar in shape.
I’m quite fond of this post as it managed to generate a fair amount of work from an observation I’m sure many people have idly made while stuck in traffic. As the great Adam Savage once said, the only difference between science and mucking about is that science is written down. I think this post therefore qualifies!