The Parabolic Parking Problem
Some time ago I was wondering how, in the event that I became overlord of an evil parking meter company, I could make a parking meter with a somewhat skewed sense of fair.
My goal was simple: order 1 hour, get one hour; order 2 hours, get 1 hour and 59 minutes; 3 hours, 2 hours and 57 minutes; etc. To start, I made a table of my desired values.
Hours Requested | Hours Returned |
---|---|
1 | 1:00 |
2 | 1:59 |
3 | 2:57 |
4 | 3:54 |
5 | 4:50 |
6 | 5:45 |
The first part of the problem I realized was the fact that I'd need to convert the time returned to minutes, giving me the initial equation of:
$$ f(x)= x + ??? $$
After some struggling---trying various linear functions, logarithmic functions, and even mixing linear and rational functions---I returned to my original table to think about just what it was I was going for. Then I noticed the pattern with how I wanted the minutes to fall: it was the sum of all of the inputs up to x
. With that, I had the final piece to complete this puzzle.
$$ f(x) = 60x - ? 1 ... x ? $$
I had the idea of what I wanted to do, but I didn't quite have everything I needed. Then I remembered a handy equation for getting the sum of every number up to n
: $$ \frac{n(n - 1)}{2} $$
Finally, I had everything I needed to squish it all together.
$$ f(x) = 60x - \frac{x(x - 1)}{2} $$
x | f(x) |
---|---|
1 | 1:00 |
2 | 1:59 |
3 | 2:57 |
4 | 3:54 |
5 | 4:50 |
6 | 5:45 |
If this equation doesn't quite get evil enough for your plans, add 4 (or some other number) to x in the sum calculation as such:
$$ f(x) = 60x - \frac{(x + 4)([x + 4] - 1)}{2} $$
x | f(x) |
---|---|
1 | 0:50 |
2 | 1:45 |
3 | 2:39 |
4 | 3:32 |
5 | 4:24 |
6 | 5:15 |
This will greatly accelerate the rate at which you can collect that sweet, sweet ticket money while still making everything look fair. But how would you like computing that thing every time? Now that we have an equation that works, it's time to simplify!
$$ f(x) = 60x - \frac{(x + 4)([x + 4] - 1)}{2} $$
$$ f(x) = \frac{120x - (x + 4)(x + 3)}{2} $$
$$ f(x)=\frac{120x-(x^{2}+7x+12)}{2} $$
And there you have it! An equation to use whenever you need to fix a parking meter such that it speeds up the time until you can collect that precious, precious ticket money.