asterroc: (xkcd - Escher)
asterroc ([personal profile] asterroc) wrote2007-10-13 11:50 am
Entry tags:

Optimizing my commute IV

With some help from [livejournal.com profile] jethereal the other day, and his awesome TI-89, I have solved my commute. The optimal speed for me to drive based upon gas mileage and time spent is 95mph. Since I also want to take into account safety and tickets, this means drive as fast as I feel is safe and won't get me ticketed, so my current trend of going 75ish seems good to me, and I should *not* try to slow down.

Solution

I assumed that my car's gas mileage is a quadratic function (y=gas mileage, x=speed), with two known points (74mph, 37mpg) and (55mph, 40mpg), and the latter is the maximum possible gas mileage and therefore has a slope of 0. This lead to three linear equations:

y=ax^2+bx+c
y=ax^2+bx+c
y'=2ax+b

(74^2)*a+74b+c=37
(55^2)*a+55b+c=40
110a+b+0=0

a=-0.00831
b=0.914
c=14.861

y=(-0.00831)x^2+0.914x+14.861
g(v)=(-0.00831)v^2+0.914v+14.861


Total cost of my trip will be a combination of the cost of gasoline, tolls, time driving, and time in traffic at either end (assumed to be 20 min, or 1/3 hour).

Let x=distance, v=speed, t=duration of trip, t_p=value of my time, g_p=cost of gas, H=hours worked per week, S=yearly salary, T=$tolls

$gas=(x/g(v))*g_p

$time=t(v)*t_p
$time=(x/v)*(S / (52 wks * H))

$tot=$gas+$time+${20 min}+$tolls
$tot=(x*g_p/g(v)) + (x/v + 1/3)*(S/52H) + T

where g(v) is defined above, and let
g_p=2.56
H=40
S=45,000


I then used the Ti-89 to take the derivative for me (wrt v) and find where the derivative is equal to 0 (that is, local max/min). This gave me solutions of

x=0
v=95.04
v=179.51


The trivial solution is that I can minimize the cost of my trip in terms of both dollars and time if (x=0) I live in my office, or I work from home. A little further exploration showed that v=95 is a local minimum (good) and v=180 is a local maximum (bad). Despite the fact that the faster I drive, the worse my gas mileage, the time savings dominates until I reach 95pmh. At that point the gas mileage is bad enough that it makes the cost worse and worse until I hit 180mph - if I drive faster than that I should start saving money again.

So I think I determined the real reason that some people drive 95 mph on the highway: they're mathematicians!

x-posted to [livejournal.com profile] mathsex

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting