They say that "time is money," which might indeed be true. But if that's the case, how do you best optimize your costs? Let's consider your daily commute to work. Should you drive fast (but still within the legal speed limit) to save time? Or maybe you should drive slowly, so that your car gets better fuel efficiency since gasoline is money too?
There must be some perfect driving speed that optimizes the total cost. Let's do this.
Most cars still run on gasoline. It's not great for the environment, but it's pretty hard to beat the energy density in gasoline. The amount of gas that a car uses, however, depends on the driving speed. If a car just sits at rest, it uses gasoline to run the engine but it doesn't go anywhere—this is a very low fuel efficiency state. As the car increases speed, it takes less time to travel one mile such that it gets better fuel efficiency (in miles per gallon). However, as the car continues to increase speed, there is an air drag force that causes the engine to work harder and burn more fuel, so that the efficiency decreases.
But how do you get a model for the fuel efficiency of a car as a function of speed? You could build something based on the estimated air drag on the car, or you could just get a model experimentally. I'm going with the second method. You can collect data with some type of device that plugs into your OBD (on-board diagnostic) port. These things are pretty awesome. I have one that gives a bunch of great data. Here is a plot of the fuel efficiency for different speeds for my car along with the average of all users with the same car.
But wait! I can get even better data. Here is the same plot for ALL vehicles (that use the same OBD) in my region. In this case, I captured the data and loaded into plot.ly so that I could fit a function to the data.
It's not perfect, but it looks like I can fit a parabolic function to this data. This gives the following relationship between efficiency and speed. Yes, I am using imperial units since that's what the OBD uses.
Also, I know—it's OK, I know. You just gloss over these equations when I put them in here. Honestly, it's fine. You don't need to know the values of the fitting parameters. However, by including them in this post you can see that they actually exist. As a bonus, if you need to reproduce my model these numbers are going to help.
OK, but how does this function work? Based on this model (this is just a model), I can find the fuel efficiency for any car speed. Let's say I have a car traveling at 10 mph, according to this it would get 10.22 MPG. At 100 mph, it would get 13.5 MPG—warning: don't drive at a speed of 100 mph.
Finally, there is one more part to this gasoline cost. If I know how many miles (let's call this d) and the fuel efficiency (F) as well as the price of gas (P) per gallon, then I can calculate the cost of driving.
Paying for gasoline is only part of the commuting price.
Let's say you make 15 dollars per hour. If your commute takes one hour, that is like losing 15 dollars since that's time you could have been working. Yes, I said "like" losing 15 dollars. You aren't actually losing money, but just stay with me for now.
Oh, maybe you don't get paid by the hour? If you are a salaried employee (or especially if you are self employed), that commuting time is still time—it's still like lost money. Wait. What if your job is to drive a car? What if you are an Uber driver? I guess this model doesn't work for that case.
Anyway, let's say that your pay rate is R (in dollars per hour). The amount of money lost depends on the commuting time---which also depends on the distance. That puts the total cost (lost wages plus fuel) at:
That's it. We are ready to look at commuting costs.
You are going to have to make some choices here. In particular, you need determine how far you are going to commute and how much you make per hour. You need to know the price of gasoline too. Once you have those two estimates, you can enter them in the following calculation. When you click the "play" button, it should produce a nice plot of cost as a function of driving speed. If you want, you can just use my default values so that you don't have to change the code.
Boom. There you have it. Notice that the code also prints out the optimal speed and total cost. Warning: if the optimal speed is greater than the posted speed limit, just go the speed limit.
Now for some homework.
- If you change the commuting distance, the total cost changes. However, the optimal speed does not change. Why?
- Create an algebraic expression for commuting cost as a function of driving speed. Take the derivative of cost with respect to to speed to find the minimum cost. Yes, this is the classic max-min problem in calculus. Do you get the same result as in the program? If you don't, someone made a mistake.
- How high does the price of gasoline need to get so that someone making 15 dollars an hour would have an optimal commuting speed of 60 mph? You can solve this with brute force or you could create another program.
- The fuel efficiency function I use has a max efficiency of around 25 MPG. What if you remove all the efficient cars and just have trucks and SUVs? Create a new efficiency function and find the new optimal speed.
- Use a model for the air drag force (I would say it is proportional to the velocity squared) and estimate the decrease in efficiency when going from 65 mph to 75 mph. Does this sort of agree with my efficiency function?
- Suppose you make 15 dollars an hour. How does the optimal commuting speed change with the price of gasoline? Make a plot of optimal speed vs. gasoline price.
OK, that should be enough homework to keep you busy during your daily commute.
- So much genetic testing, so few people to explain it to you
- When tech knows you better than you know yourself
- These magical sunglasses block all the screens around you
- All you need to know about online conspiracy theories
- Our 25 favorite features from the past 25 years
- Looking for more? Sign up for our daily newsletter and never miss our latest and greatest stories