Optimizing my commute IV
Oct. 13th, 2007 11:50 amWith some help from
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:
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).
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
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
mathsex
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
no subject
Date: 2007-10-13 05:23 pm (UTC)XD
no subject
Date: 2007-10-13 07:41 pm (UTC)no subject
Date: 2007-10-13 07:46 pm (UTC)no subject
Date: 2007-10-13 09:12 pm (UTC)Someone else also pointed out that I shouldn't've found a quadratic function for miles per gallon, but a quadratic function for gallons per mile, so that I wouldn't end up with a function that has negative mpg. If I really did drive at 180 mph, I'd get a gas mileage of -90 or something.
no subject
Date: 2007-10-14 12:01 am (UTC)Not to be totally depressing, but maybe your time is worth less than what you projected, unless that salary you've already defined represents after tax money!
I'm a little confused at how you arrived at your numbers for your current distance x... Shouldn't you be solving for x = current distance when you set the derivative to 0? I find it surprising that when x=0 and x=n that your derivative would output the same local maximums and minimums.
That said, subjectively speaking, is there be a strong correlation between speeding cars and how much money people make?
no subject
Date: 2007-10-14 01:54 am (UTC)As for how much my time is worth, I feel that my free time should be worth at least as much to me as it is to my employer, hence using my salary for the cost of my time.
And regarding the distance x, note that function $tot (in bold) has an x in both of the first two terms (and the third is just a constant). The constant drops when you take the derivative (I'm trying to minimize the total cost), and then when you set the derivative equal to 0 you get one solution is x=0 and the others give you values for v.
I do think the fast cars usually tend to be nicer cars, so at least they're people who spend what money they have on cars.
no subject
Date: 2007-10-14 04:51 am (UTC)