asterroc: (xkcd - Escher)
[personal profile] asterroc
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

Date: 2007-10-13 05:23 pm (UTC)
From: [identity profile] framefolly.livejournal.com
So I think I determined the real reason that some people drive 95 mph on the highway: they're mathematicians!

XD

Date: 2007-10-13 07:41 pm (UTC)
From: [identity profile] jrtom.livejournal.com
Wasn't there supposed to be a factor in here somewhere for the expected value of tickets associated with driving at a particular speed? (Of course, if p(ticket) > 0, then the correct answer becomes "don't exceed the speed limit" in the limit as t->infinity, since if you get enough speeding tickets they take away your license...but if the expected time between tickets is long enough, you might reasonably suppose that you'll either move or die of old age before they can take your license. :) )

Date: 2007-10-13 07:46 pm (UTC)
From: [identity profile] jrtom.livejournal.com
Whoops, I just re-read the post...p(ticket) is essentially external to this calculation for how you're doing it.

Date: 2007-10-13 09:12 pm (UTC)
From: [identity profile] zandperl.livejournal.com
Yeah, it'd be nice to put in a term for tickets, but I hadn't yet. I'd have to put in the probability of getting a ticket, cost of a ticket as function of speed, cost of car insurance increase, and once I get N-many tickets the cost becomes essentially infinite as I'd lose my license.

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.

Date: 2007-10-14 12:01 am (UTC)
From: [identity profile] blahblahboy.livejournal.com
I don't know if your tolls come from using the Mass Pike, but I know people using EZ-Pass / Fast Lane who got tickets for speeding!

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?

Date: 2007-10-14 01:54 am (UTC)
From: [identity profile] zandperl.livejournal.com
I haven't heard of anyone getting tickets based upon FastLane times, but that's not to say it can't happen. Frustratingly, FastLane prices other than in the Boston area are identical to cash prices, but at least it's usually faster lines - when the cash people aren't blocking my lane.

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.

Date: 2007-10-14 04:51 am (UTC)
From: [identity profile] blahblahboy.livejournal.com
Duh. I think I need to go back to school. All this crap work is making my brain turn to mush.

Profile

asterroc

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819202122
232425 26272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 24th, 2025 05:48 pm
Powered by Dreamwidth Studios