Wednesday, May 2, 2012

The Math of the Deeprun Tram

Moving Away At Other Station Coming Back Arrives At Your Station Leaves with you m w m w m How many times have you gone to the Deeprun Tram and it was there, waiting, but was gone before you could get to it? If you're a frequent Alliance player, probably tons of times. And whenever that has happened, have you said to yourself, "They should make it wait longer, then people wouldn't miss it so often and people would get to their destination faster." How would you feel if I told you that wasn't the case and that perhaps it waits too long?

On the left I have a little diagram, the part in orange is the part of your journey which you must always endure, the actual travel. The part in white represents where the tram may be when you are actually ready to board it (and not just running to be ready to board). When you are ready to board you may arrive at any one of those points. So your actual time spend waiting on the tram and traveling on it is
where X is a uniformly continuous random variable that ranges from zero to 2m+2w, where m is the amount of time spent moving from one side to the other and w is the amount of time the tram waits at each stop.

What we want to do is we want to minimize t. Or rather, we want to minimize the average value of t. We do this by calculating what's known as the expected value of t, E(t).
I'm fairly certain that I don't REALLY need to go through this next part, but it's a good indication of where calculus is helpful in real life type situations. That and I've spent a good amount of time teaching mathematics and I can't resist a good example. In order to minimize a function (which E(t) certainly is), you take the derivative and check the value of it when that derivative is zero, at endpoints, and at discontinuities. In this case, our variable is w, the amount of time spent at the station. The partial derivative of E(t) with respect to w is
This is because the partial derivative with respect to w of 2m is zero and the partial derivative with respect to w of w is 1.

Here we find that the derivative is never zero, so that means our function, E(t), must be minimized at an endpoint, in this case w=0. So with the goal of people arriving at the other side as fast as possible, it is optimal that the Deeprun Tram (and this can be said of other transports) not wait at all? Well, this is a mathematical model, and there were some limitations put on it to make it simple. What this tells us is that it is optimal for the tram to wait only long enough to let the people who are waiting for it board, which when you think about it, makes sense.

Why is that so? Wouldn't it benefit from waiting longer so that people who are close can get on? No, because if the tram waited longer, that would make its round trips longer and it would make the people who are on it and waiting for it to depart have to wait longer for it to leave.

This post was a fixed-up, more elaborate, better version of a blog post that I did when my blog was young. Many of those older posts have good content, but I was just terrible at writing/the web at the time and I feel they deserve a second chance. Furthermore, since it was old, I bet nobody saw it.