Travel Math

I’ve been thinking about math and traveling lately, and have developed a few formulas which appear to hold true for an indeterminate percentage of situations.

For example, it appears that most of the time

And the amount of oncoming traffic is inversely proportional to the speed of the driver, as confirmed by variable speed travel. (That is, the slower you travel, the more oncoming traffic you will encounter.)

This ensures that

where

In short, you never have enough time to pass safely.

Now, when you have people following you, the math is a little bit different.

This is also known as the irritation level:

Which brings up an interesting side note: (The faster the car goes when passing you the more likely that the driver is on a cell phone.)

And finally, the logic:

IF (irritation level) > (posted speed limit) THEN
(speed limit) = (irritation level);
(road centerline) = NULL;
ELSE
(distance behind your car) = 1 / (irritation level);
END IF

In short, I am reminded of what I was told my my driving instructor when I first learned to drive.

“Everyone who drives faster than you is crazy and everyone who drives slower than you is an idiot.” – Pike

Game Theory

I recently saw “The Good, The Bad, & The Weird”, (side note, I’d rate the movie 1/5 stars, it didn’t hold my interest), but at the end of the movie there is a three way duel. I was intrigued by the strategy that would take place in a three way duel, provided the right groundwork is set up. (The duel in the movie is not really that spectacular.)

The Rules:
Duelist A has a rifle, duelist B has two pistols, and duelist C has a single handgun (gun type doesn’t really matter). Assume that all the players shoot to kill and have perfect aim, except player B who cannot aim in two directions at once. For the sake of easy math, let’s say that if player B points a gun at each opponent but only looks in one direction he will kill the person he looks at and has a 30% chance of killing the other player. (I postulate this 30% chance as an option, but I will not take it any further in my analysis. The added complexity might change the strategy, but I do not feel it’s worth exploring for me at this time.) If player B aims at both opponents with peripheral vision, he has a 50% chance of hitting both opponents. Assume also that all the players are capable of shooting at least once in the duel and I see no reason for a limitation on ammo, as they have perfect aim. The person who does not get shot wins the game. It’s possible for the game to have no winners, in fact, it seems likely.

The Theory:
Since player B has two weapons, it makes sense that he would point a gun at both opponents in the best scenario he would kill both. This means that each opponent has a 50% chance of being killed. Players A and C then have quite a bit of incentive to both fire at player B. But since both A and C have 100% chance of killing player B, one of the bullets would be wasted and they would kill each other with the second shot (provided they survived the shots from B). With a 50% chance of surviving a shot from B it would be more beneficial to kill off the person with a 100% chance of killing you, so A and C should really shoot at each other. If they shoot at each other, no one shoots at B and B would survive.

The Hypothesis:
My original assumption in creating this scenario was that it would be more beneficial for a player with one gun to shoot at the other player with one gun than to shoot at the player with two guns, which seems like the first logical choice. This strategy is only beneficial, however, when one of the one gun players fires at the two gun player.

As I continue to think this over it looks like a game where there can really be no winner, except maybe B. But what if each character had 90% accuracy rather than 100%. In stating this I realize that perhaps a limitation on ammo could be necessary, at which time I might suggest moving to a 2 shot per person system where multiple winners would be accepted. It would depend on how the numbers work out.

The Math:
Originally I planned on writing up the theory of strategy that one could use in this situation, but as I put my thoughts onto paper I realized that a simulation would be really helpful in finding out what strategy actually worked for this. So I decided to do some math.

For experiment one I assumed that player A would always shoot player C and that player C would shoot randomly at the other players. Using a coin I flipped for C, heads meant he shot at A, tails was a shot at B. I then flipped the coin for B twice, once for a shot at each opponent, where heads was a hit and tails was a miss. I did this ten times, my results were unsatisfactory.

1: A shoots @C; B misses A, B misses C; C shoots @A; B wins;
2: A shoots @C; B misses A, B misses C; C shoots @A; B wins;
3: A shoots @C; B hits A, B hits C; C shoots @A; B wins;
4: A shoots @C; B hits A, B misses C; C shoots @A; B wins;
5: A shoots @C; B hits A, B misses C; C shoots @A; B wins;
6: A shoots @C; B misses A, B misses C; C shoots @B; A wins;
7: A shoots @C; B hits A, B misses C; C shoots @A; B wins;
8: A shoots @C; B misses A, B hits C; C shoots @A; B wins;
9: A shoots @C; B misses A, B misses C; C shoots @A; B wins;
10: A shoots @C; B hits A, B hits C; C shoots @A; B wins;

Nine of the ten matches were won by B. The one other match was won by A. This led to a facepalm realization I didn’t discuss yet. If A decidedly shoots C, C is incapable of winning. That said, whoever A and C shoot can’t win.

This required more randomization than I was willing to flip for, so I headed to the language I know best, (which isn’t saying much) PHP.

After some tweaking and experimenting I formulated the following code:

$i = 0; //loop counter
$j = 0; //everyone is dead counter
$a - 0; //A survives counter
$b = 0; //B survives counter
$c = 0; //C survices counter
$t = 0; //counter for two living at the end

while($i != 9000) {
	//assume one shot each, except B who gets two simultaneous shots.
	$i++;
	$Arand = rand(1,2); //1 is a hit, 2 is a miss
	$Brand1=rand(1,2); //1 is a hit, 2 is a miss
	$Brand2=rand(1,2); //1 is a hit, 2 is a miss
	$Crand = rand(1,2); //1 is a hit, 2 is a miss

	//set all players to alive
	$A = "alive";
	$B = "alive";
	$C = "alive";

	//find out who gets shot and dead them
	if($Arand==1){
		$B = "dead";
	} else {
		$C = "dead";
	}
	if($Crand==1){
		$A = "dead";
	} else {
		$B = "dead";
	}
	if($Brand1==1){
		$A = "dead";
	}
	if($Brand2==1){
		$C = "dead";
	}

	//is everyone dead? at least one person will die
	if($A==$B&&$B==$C){
		$j++;
	}

	//unlikely but possible that two people live (more likely than I first thought)
	if(($A=='alive'&&$B=='alive')||($A=='alive'&&$C=='alive')||($C=='alive'&&$B=='alive')){
		$t++;
	}

	//add up the living people
	//display their status in color
	if($A == 'alive'){
		$a++;
		echo "<font color='green'>".$A."</font> ";
	} else {
		echo "<font color='red'>".$A."</font> ";
	}
	if($B == 'alive'){
		$b++;
		echo "<font color='green'>".$B."</font> ";
	} else {
		echo "<font color='red'>".$B."</font> ";
	}
	if($C == 'alive'){
		$c++;
		echo "<font color='green'>".$C."</font> ";
	} else {
		echo "<font color='red'>".$C."</font> ";
	}

	//line break
	echo "<br />";

}
	//total the stats, who is it better to be?
	echo "All die in ".$j." battles, thats ".(($j/$i)*100)." percent.<br />";
	echo "Survival rates for <br />A: ".$a." battles or ".(($a/$i)*100)." percent <br />B: ".$b." battles or ".(($b/$i)*100)." percent <br />C: ".$c." battles or ".(($c/$i)*100)." percent <br />";
	echo "in ".$t." battle(s) two people lived. Or ".(($t/$i)*100)." percent.";

I ran the code a number of times with different loop values. Lower loop values led to a little more variation, but that was to be expected with a smaller sample size.

Finally I settled on 9000 games and gave it a run, here’s my result:

All die in 2828 battles, thats 31.422222222222 percent.
Survival rates for
A: 2243 battles or 24.922222222222 percent
B: 2248 battles or 24.977777777778 percent
C: 2243 battles or 24.922222222222 percent
in 562 battle(s) two people lived. Or 6.2444444444444 percent.

These numbers are fairly consistent across multiple runs of the script. They also surprised me.

According to these numbers everyone died in 31% of the games. That means in ~70% of the games there was a winner. In this 70%, each player survived about 24% of the time. My original thought was that one player might have a competitive advantage over a different player, but this seems to indicate the survival rates for all are the same.

Granted, this “study” lacks any personal bias or thought process when all the decisions are made randomly, but I wanted to know if there was any value in choosing one player over another. In a completely randomized world, there isn’t.

The Conclusion:
There are a lot more potential variations of this game that could be tried, but I feel that my testing worked well for my limited purposes. As I view the final results of my code, I can’t help but compare this type of game to a three way game of paper, scissors, rock.* It might be interesting to look at the scenario from that viewpoint more closely and compare two simulations, but I won’t be doing that.

Overall this was a fun little project to distract from the daily monotony from which the mind rebels.

*Yes, I know that some people have learned the game as “rock, paper, scissors” but as a Communication Specialist, I am forced to disagree, purely on a syllabic count. Paper and scissors both have two syllables, which means they take longer to say and are not as emphatic. Rock, on the other hand is a shorter word with one syllable and can produce a sharp punctuation of sound, which lends itself nicely to a climactic unveiling of weapon choice. You’re welcome to use whichever is more comfortable to you personally, but I can’t help but point out that there is an emotional and atmospheric reason for choosing the order of the words. Choose correctly!

Problem Solving

The first person to complete this test with 100% or more will win an “i 8 Pi” shirt. Answers may be submitted via email to mathnerd@apatheticthursday.net.

Use the information below to answer the following questions. Show your work for full credit.

JK Diecut cuts rubber golf cart mats. Pallets of rubber are shipped in, each pallet containing 8 rolls of rubber. Each roll is 37 inches wide and needs to be cut into 20 sections each measuring 45 1/2 inches long. Each section produces 3 golf cart mats. Cut mats are placed in boxes, each box holding 60 mats. 9 Boxes are placed on a pallet to be shipped out.

If JK Diecut receives 15 pallets of rubber to cut, how many sections need to be cut?

How many mats will be produced?

How many pallets will be shipped out?

If it takes six punches of the die press to cut a section into mats, how many punches will it take to complete the order?

If it takes 5 minutes to cut a roll into sections and 15 minutes to cut a box of mats, how long does it take to complete a pallet?

How long will the whole order take?

Bonus Question 1: Say it only takes 3 minutes to cut a roll into sections and 12 minutes to cut a box of mats. How long will a pallet take now? How about the whole order?

If there are 3 people working this job at all times, how many man hours will the job take?

Each mat is worth $1.30. How much is each pallet worth?

If JK diecut requires 65% of the order to go back to the business for expenses, what is the highest hourly wage they can offer to their employees for this job?

Bonus Question 2: If the employees can work as fast as stated in Bonus Question 1, what is the highest hourly wage that can be offered the the employees?

It use to take 45 minutes to cut a roll and 30 minutes to cut a box. How long would this order have taken then?

Bonus Question 3: If the employees work at the old speed, what is the highest hourly wage that they can be offered?

How much longer did the old method take?

In the past it took 3 punches of the die press to cut a mat. How many punches would this order have taken?

Each saw cut shaves 1/8 an inch off the roll. How much rubber is wasted per roll on this step? How much for the whole order?

Given the shape and dimension of the mat below, give the area of the mat and calculate the rubber wasted from each section when it is cut into mats.

Add the wasted product from the saw cuts to the rubber wasted from each section.

Bonus Question 4: The saw runs for 3 seconds to cut each section. If the saw speed is 5400 rpm and acceleration and deceleration are practically instantaneous, how many revolutions does the saw blade make for the full order?

JK Diecut has a dumpster named Eliot. The Managers want to know how many times Eliot will need to be emptied over the course of the order. Eliot’s base measures 56 inches by 25 inches while Eliot’s top measures 64 inches by 32 inches. Eliot is 42 inches tall.

Assume the following:
- The rubber is placed into Eliot carefully and efficiently, leaving only 10% of the dumpster space unused. (Due to holes and air pockets.)
- The 10% of free dumpster space may be filled will the rubber shavings from the saw cuts.
-The garbage company refuses to pick up the dumpster if the lid does not fully close. (The dumpster may not be filled past the top.)
- The rubber that is being cut is all 3/16 inches thick.

How many times will the dumpster need to be emptied during the course of the order?

In ideal situations each roll should have enough rubber for 20 sections. In reality some only have enough rubber for 19 sections. It is estimated that 23% of the rolls only produce 19 sections, rather than 20. How does this effect the number of outgoing boxes?

How does this affect the total order cost?

How about the employee’s wage?

Bonus Question 5: The Rubber Manufacturer hears JK Diecut’s estimates and decided to check out things out for themselves. They find that in 240 rolls 17% are under 913 inches long, the minimum length needed to produce 20 sections. In Their test they find that the average length is 918.85 inches with a standard deviation of 14.66 inches. Assume that the distribution of roll length is approximately normal with mean u. Is there evidence that u is less than 913 inches?

Bonus Question 6: State the null and alternative hypotheses and choose a significance level. Then calculate the test statistic and find the P-Value. Is this significant?

Purity

xkcd

dive into mark

Although, I have to say, there isn’t much point to any of those fields, if you can’t communicate your findings/theories/knowledge to a future generation… (But I’m not good enough to do a comic of that…)

(EDIT: actually entered the photos, both for better user experience and a test with some other things I am working on.)

Happy Pi Day

I am a math guy, and I enjoy doing math. So I like Pi, I think it’s a very interesting and amazing number, however, I also really like pie. For me, Pi Day is about celebrating the Greek Letter Pi, but also about baking pie.

Check back later today for today’s pie baking adventure.

Information Parasite

I am an information parasite. I thrive on information. I sit and absorb as much info as my curious little ears can take in. It’s not all relevant. It’s not all useful. This doesn’t matter though, it’s information and thats what I need.  I don’t always even remember the info I take in, but the important part was that for an instant, if only an instant, I had that knowledge.

I came to this conclusion today while walking back to my dorm room. Last semester I finished up my math minor, but I had not taken Linear Algebra yet. If I took Linear Algebra this semester I would have to pay extra because I would be in “credit overload” with 20 or 21 credits. It would also give me a lot of homework to work on. Going into this semester I saw that I was going to have a bit more free time on Mondays, Wednesdays and Fridays and have already told myself I want to use this time to improve my photography, writing skills, website design and other projects I wanted to get done.

So I decided to audit the class. So basically I’m taking Linear Algebra without paying for the credits, doing any homework or taking any tests/quizzes. (Although I do foresee myself participating in this class since it’s a small class of eight people and the information is interesting.)

The big thing that struck me though, is my motivation for taking this class is almost purely curiosity. I’m not getting any credits for it and I can’t get credits for it if I would change my mind. I’m not entirely sure if I know what this means, if it means anything at all, or if this is worth thinking over in more depth.

I’m thinking that it comes down to a love of learning. I love to learn new things, I like hearing about new technologies, I find it interesting to look into things I know nothing about. The downfall to this is that I find myself knowing a very little about a very lot of stuff, which then becomes muddled in my mind and I end up knowing nothing about a lot, but I do remember that I knew something at one time.

This may require some rethinking.

Sanity Equation: Why I must be wrong.

I recently posted my equation for figuring out your current level of sanity. (See here.) As I have been thinking about it, however, I have thought that it would be best to generalize it so that it’s usable for people who are not in school. (The whole “desired grade minus current grade” thing didn’t sit right for me.)When trying to generalize this equation, however, I have discovered that this equation doesn’t seem to work as well as I first thought. I’m not saying that it is completely void, but I think it is good to note any inconsistencies or criticisms of my work. My original equation looked like this:

 Sanity Equation

 Which I rationalized by saying that as the days of the semester came to a close, the students go insane because of all the homework and projects and tests that they have to deal with. (Stress from grades is accounted for as well.) This seems to work pretty well, I had several students tell me that they like the formula.

When you break it down to the most generic form, you find that it is simply:

 Generic Form

 This also made some sort of sense. The more work that needs to be done, and the less time that is left to do the work produces the lowest feeling of sanity. (That is, the largest feeling of insanity.) On a side note, people are not always honest or accurate with predictions of work and/or time. So perhaps the equation should read more like:

Assumed Sanity 

But back to the generic equation, anyone with an understanding of physics should quickly recognize that:

Power

 Which means that power and sanity are inverse each other.

Inverse

 But this doesn’t make any sense at all. The more power you have, the more work you can get done per time period, the less sane you will be (or feel)?

My current conclusion is that the equation should not deal with the amount of work that a person needs to do in a certain time, but maybe something along the line of the number of events happening within a given time period. Each test, project and paper are then classified as events, but the equation is still generic enough to be applied to non-school-going people as well as holidays and vacations.

When I get my equation tweaked I’ll post it here. Until then, let me know what you think. 

Equation for Insanity

UPDATE: I have discovered some issues with this equation, see my new posting here. I was thinking the other week, and developed the following formula for your current level of sanity. The main goal was to model sanity from a student’s perspective, but the formula may be tweaked for other occupations of lifestyles. Enjoy!

Sanity Level

 

The Math-Coaster

Math is like a roller coaster. It has high points and it has low points. Somedays everything works out tremendously nice and it’s the best thrill ever. Other days it’s a terrifying plunge in the dark that makes the stomach churn and the mind think, “Why on earth am I doing this? I’ll never do this again.”

I’ve had a bit of both today. It’s been up and down. It took me forever to get started, but when I did get going I got a few problems done, which I think is pretty good. Then I finished an assignment, and the downtime between assignments the feeling of finishing the work, and then trying to get started on the next assignment is the killer. It feels like I’m not getting anywhere. And it was during that break that I checked my email and found my math take home test sitting in my inbox, gleefully announcing that I had 7 days to finish it.

Unfortunately, the test is highly based on the 3 math assignments I have not yet completed, so the question is, which comes first the chicken or the egg? Do I do the assignments or the test?

I did, however, get an amazing kick out of a short little conversation I had today, it went something like this:

Guy: “Hey! What are you working on?”

Me: “Math.”

Guy: “Oh, what math?”

Me: “Real Analysis.”

Guy: “…oh… …what major are you?”

Me: “Communications.”

Guy: “… oh… … …”

Man, I just love that response from people. The class is almost worth it just for that.

Anyway, back to math…

Pi Day is Coming!

It has come to my attention that Pi day is coming up! That’s right, 3-14 will be this upcoming Wednesday! But what good is Pi day, if you don’t have an “i 8 Sum Pi” Shirt?

Everybody who is anybody has an “i 8 Sum Pi” Shirt, and you need one, and soon.

For all of those people who have an “i 8 Sum Pi” Shirt, be sure to wear it this coming Wednesday!

Spread the word, Pi out!