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 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.

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 11:04 pm
Powered by Dreamwidth Studios