Saturday, May 19, 2012

My Brush With The Lottery

Not long, a great many Americans went crazy attempting to buy a chance to win the largest lottery prize ever: the Mega Millions $656 million jackpot. And, despite my usual practice of avoiding such things with amused condescension, I was one of them. There was a pool of people buying tickets where I work, and, after considering the enormity of the prize, I put $5 (the minimum share) in. After considering the idea of actually winning, though, I began to regret my decision. After the initial thrill wore off, what would I do with all the money? Hedge funds? Charities? Investments? More importantly, who all would know that I had won and had just come into a large sum of cash? Family? Friends? Unsavory characters? People who have won the lottery in the past tend to have a record of losing both the money and their friends - sometimes even their lives. I determined the prize was like Radium; you either needed to keep it very well contained or just get rid of it.

Still, such financial quandaries aside, some of you may still be wondering why I bought the tickets in the first place. Don't I know math??? The answer is yes, I do know math. In this case, just enough to hang myself. Before I threw my money into the pot, I calculated the expected value of buying a ticket. Expected value is a simple statistical calculation that can give you a rough idea of how much each investment in some activity will gain you over the long run. If the expected value is positive, the investment is probably worth it; if not, you'll only come out ahead by being lucky. The expected value of gambling is usually negative (though there have been some instances of people cheating the system with math and coming out ahead consistently). To calculate it, you just take the reward at stake, multiply it by the probability of getting that reward, and subtract the cost.


Now, the chances of winning the jackpot were 1 in 175,711,536, the price of a ticket was $1, and, at the time, the jackpot was around $400 million. A quick calculation showed that the expected value for buying a ticket was $1.28; it was actually positive! Now, this didn't mean that I had any greater chance of winning the jackpot, but it did mean that the shear enormity of the reward was enough to outweigh the slim chance of getting it. So I bought 5 tickets.

Well, I didn't win, of course. If I had, this blog would be inexplicably gold-plated. But afterward I found myself somewhat troubled. Not because I hadn't won - I can't say I ever really expected to win - but because it looked like my calculations had somehow been wrong. Overall, Americans spent around $1.6 billion in tickets, with only a $656 million prize in return. How could the expected value have been positive and yet the overall result show a negative return on investment? After thinking about this a while, I realized that my error was that I hadn't taken into account the fact that other people were also buying tickets and that, in the case of multiple winners, the jackpot would be split. This meant that in my expected value formula, the reward would have to be divided by the number of people expected to win, including myself. This made the formula look like so:


(This holds true for either each person buying one ticket  or fewer people buy multiple tickets. The only case for which this wouldn't work is if someone were to buy the same ticket twice.)

Running the calculations again with 1.6 billion tickets purchased gave the much more reasonable expected value of -$0.63; buying a ticket wasn't worth it.

The above formula can be worked backwards, too. No prize less that $176 million is worth buying a ticket for, buying a ticket  for a $176 million jackpot would only be advisable if no one else were playing (highly unlikely), and a ticket for the recent Mega Millions would have only been worth it if no more than 480 million other tickets had been sold; less than one third the actual amount.

Now, there may still be a way to game the system. If the data were evenly distributed, the math predicts that there should have been nine winners, but there were only three. This is because people tend to pick some numbers more than others: birthdays, lucky numbers, etc. So, since multiple winners was the reason for the reduced expected value, if you were to pick numbers that other people have a lower chance of picking, you just might be able to get a positive expected value again. However, this would require more data-mining than I am capable of, and due to the large responsibilities associated with actually winning, I don't think I'm going to try.

Monday, May 14, 2012

Pinpointing Prejudice

In a way, I tend to agree with the Avenue Q song "Everyone's a Little bit Racist." Even if we don't believe that any one race is superior to another, we all go through life with our views of others shaped by our encounters with people or portrayals of people that share similar traits. This can be anything from race to clothing style to area of study; as a species we are very keen on recognizing patterns and will therefore group those around us into categories based on what we know (or think we know) of others like them. This is exaggerated by a form a bias: we tend to more readily notice things that are different from ourselves and use them as labels.

I've had this in mind for a while, but it was recently brought to my attention by an encounter at work. I was walking down one of the hallways when I passed a janitor who happened to be black. Almost instantly the thought came into my head, "I wonder why all the janitors here are black?" Soon I was thinking about potential class and educational barriers and even - horrors! - inherent ability. It was at this point that I stopped myself. This train of thought couldn't be right, so I re-examined it and realized that I had taken for granted the fact that all the janitors were black. In reality, the janitors in our building are a fairly even mix of races; I had just noticed that the black ones were black because this was the trait most different from me. Whenever I would see one, rather than thinking "there's a janitor" like I did for any of the other races, I would think "there's a black janitor." While this was technically true and without any negative association, it was a distinction that was applied unevenly, resulting in my unquestioned assumption that all the janitors were black simply because that was the only descriptor that had ever been applied to janitors in my mind.

This has happened to me before. I've found myself moving from people like Ian McKellen and Neil Patrick Harris to thinking, "Man, all the great actors are gay!" In addition to this being a conclusion based on a terrible sample size, it failed to take into account people like Liam Neeson and Viggo Mortensen, other great actors for whom I had not associated a sexual orientation with their careers because it wasn't different from mine. For my mind, there was no reason to think, "Wow, they're a great actor and they're straight," because the fact of them being straight was considered to be something normal enough to be assumed and therefore not explicitly remembered. But when Ian McKellen came along, the knowledge of him being gay was so shocking (Gandalf is gay?!?!) that it was burned into my memory as being associated with his profession.

Now I'm not saying that we should all keep track of all aspects of a person, however familiar they may be - that would take far too much work. And not associating various traits of people to each other may very well be impossible. But whenever we find ourselves wondering why all of a certain demographic is a certain way, it would pay to examine our base assumptions. It's entirely possible we have accepted something false as truth simply because one aspect of it was more noticeable.

Monday, September 5, 2011

While I Was Out...

Well, posting has been sparse recently, and there's a good reason for that: I've been on vacation.

My vacation started on August 19 when I went to a friend's wedding up in Oregon. I was there for the weekend, and it was a good time with lots of food, old friends, and, of course, the wedding. The ceremony was very simple yet elegant, and was followed by a massive reception (apparently the bride's family has a reputation of being very hungry, but not all of them were able to make it, so there ended up being a surplus of food). I helped some in the kitchen and with clean-up, but was mainly there to attend.

Non-ceremony highlights included creating a whirlpool and playing with slot cars. These happened after the wedding when it was just a bunch of guys hanging out. First we went to a small community pool and, wondering if we could actually make a whirlpool, all started running in a circle in the 4-ft. water. There were about 20 of us, and we were able to get a noticeable depression in the middle of the pool. At this point, we attempted to suddenly reverse direction, resulting in mass floundering and hilarity. We managed to repeat this three more times and were all very tired after doing so. Later that night, the father of the bride brought out an old slot car set, and Synk, Hopps, and I had far too much fun seeing just how crazy of a track we could make, with an ever-growing loop-the-loop and a vertical portion of track. Part of our excitement was dulled when we discovered that the cars were magnetic and would stay on the track just about no matter what, but it was still pretty cool.

Right after I got back from Oregon, I drove down to Texas to spend the week at my old dorm, 41, during the floor's "Expended Orientation" for the freshmen. A lot of people immediately think of this as some sort of hazing, but that implies that we're harming the freshmen or lording our seniority over them, when it really consists more of playing late-night games of Capture the Flag and traversing campus en masse to sing "500 Miles" to all the girls dorms. Rather than being some sort of price to join the floor, I found it was the most fun I had my freshman year. And it creates the kind of bond that has people like me using up my vacation days to visit the floor over a year after I graduated.

While the whole EO week was very fun, one thing that was very weird to me was that, except for two days when other alumni showed up, I was the oldest 41er present. There were even some guys who returned as alumni that I had seen come onto the floor as freshmen, making me feel kind of old. Aside from general aging, though, I think much of my disconcertion was caused by the fact that my older brother also stayed on 41. For a long time, I was "Fjord's younger brother," but now there isn't anyone left on the floor who has met Fjord, and I suddenly ended up in the position of being Grey, the eldest.

Weird.



At this point, some of the more astute of you may have realized from the dates given that my vacation ended over a week ago, yet I'm just now getting around to a post about it. This is because after I got back, I lost just about all motivation and my life became very much like this comic. Fortunately, with the long weekend, I'm starting to become bored with being bored, and my motivation cores are coming back online. This means that, with any luck, the Facebook-promised post detailing the construction and workings of my Archimedes Death Ray (oh, yes!) should be coming sometime this week.

Until then, have some steak. I know I will.

Saturday, August 13, 2011

Corn Chips Are No Place For Me!

A little over a week ago, I was informed of the existence of the Warrior Dash. This is a 3.5 mile run with 12 obstacles, including an 8-ft. wall, barbed wire, and fire. There just happens to be one going on in Tulsa next month, and a lot of guys from work have been encouraging me to go with them. Aside from the fact that the partying atmosphere isn't really my thing, the race itself does seem pretty awesome and I've decided that it's something I want to do; I'll just decline the beer, enjoy my turkey leg and be on my way.

I have not, however, signed up yet.

This is because I started training last week, and to my disappointment I was unable to even run a mile. Now I know that this is something that my body is capable of (or at least used to be capable of); I was able to run 2 miles without much difficultly a year ago. I suppose I just need to get warmed up to that level of activity after almost a year of sedentary living. I'm just not entirely sure I can get warmed back up in time for the race.

So, I have been following the "I just want to finish" training schedule on their website, with the intent of signing up as soon as I'm able to complete the recommended running distance for that day (I have until the 28th before the price goes up). We'll see how I do tonight.


(I suppose even if I can't run the entire thing, I do know that I can keep up a 4.5 mph walking pace just about indefinitely, so there is that.)

Sunday, July 31, 2011

Dnoces a Em Evig

Greetings, Internet.

As you may recall, in my last Project post, I outlined my results concerning the creation of a temporal wormhole in a simple electrical circuit. I also mentioned that these results came with certain assumptions, one of which being that the flow of time was the same on either side of the wormhole. I have since been working to figure out what the results would be if this was not the case.

First, I attempted using differential equations and a similar approach as last time, only instead of having a parallel circuit I had two circuits that influenced each other, but each effect was reversed in time.


Something like this.


After struggling with this for a while, I determined that the math was, in fact, actively malevolent. I therefore decided to try a numerical method. While less exact than an algebraic solution, this would in theory be easier to implement. I chose to use Eulers's method instead of Runge-Kutta, again because it was simpler and fit very nicely with the fact that the equations for the current through a capacitor gave me the slope of the voltage. I also knew that the overall calculations would involve some self-referencing iteration, and I wanted to keep from muddying things up as much as possible.

Since numerical solutions sometimes have problems with accuracy (and also since it was so easy to implement changes) I tested my calculations first with a non-wormhole setup to check for accuracy, then with a common-flow wormhole (the one from last time) to check that the whole self-referencing thing worked out. I had to make several revisions as I apparently made some mistakes in my math somewhere, but I eventually got a working version and was able to run it on a reverse-flow wormhole.

When I was thinking about it before-hand, I pictured that the results from a reverse-flow wormhole would be much "smoother;" that the voltage would always be decreasing, just at different rates. I figured this because a way of thinking about the reverse-flow setup is that the two instances of the wormhole both start (or end) and the middle, then spread out from there. This means that the midpoint where they meet should be decently discontinuous. I also viewed the second instance of the wormhole as a capacitor charging in reverse: a somewhat straight line dropping off faster and faster. These two conceptions formed a mental image something like the tangent of negative pi.

Then I actually ran the numbers.


The result is not a smooth, continually decreasing curve, but rather it forms an even deeper bowl than a common-flow wormhole, with steep sides at either end. The middle area is still smooth, but my idea of the wormhole's second instance looking like a capacitor charging in reverse was wrong; from the perspective of the capacitor, it's still charging in normal, forward time, it's just the voltage source that it charging from is in reverse.

While these results are kind of neat, I am kind of disappointed that they didn't come out how I was hoping. If the voltage was continually decreasing, I was planning on making a graph with the time axis stretched and compressed until the curved looked like a typical capacitor discharge in order to give a better idea of what the wormhole did to the time-line of the event. I had also hoped to make an experiment with an event-dependent wormhole, where the second instance wouldn't start until the voltage reached a certain level or something, but if the voltage is not continually decreasing, there may be issues with opening the wormhole at the "wrong" place. Or maybe not. I'll have to think about it.

Monday, July 18, 2011

Perils of Procrastination

I have learned an important lesson this week: NEVER put off booking a flight.

A good friend of mine is getting married toward the beginning of next month, and both Hopps and I were invited to the wedding. I eagerly responded that I would attend, and proceeded to get the necessary time off from work. I did not, however, book my flight. The reason I did this is because I wanted to coordinate my travel with Hopps, if possible. The actual location of the wedding is about an hour away from the airport, and if we both arrived at the same time it would save on a taxi or be more convenient if someone was picking us up. For his part, Hopps, having just started work, was trying to work out if he could get time off and then waiting for confirmation.

We checked ticket prices about a week ago, and while they were a bit pricey (the airport we would be flying into is not frequented by airlines as often as others) we decided that we could manage to fit them into our respective budgets. Some more time went by without Hopps knowing for sure if he had the day off, and eventually I decided to go ahead and book my flight anyway. So this last weekend I got on the internet to book my flight. I wasn't too concerned about the price; the wedding was still three weeks away, and prices couldn't have gone up that much, right?

WRONG.

In the several days since we had last checked, the price for a round trip had increased to almost 150% of its previous value, putting it way beyond what we had decided was pushing it for our wallets.

And now, I have just gotten of the phone with my friend after explaining to him why I won't be coming even though I had told him many times that I would. Uhhhg.


I have another friend getting married at the end of August. I will be booking that flight tomorrow.

Thursday, July 7, 2011

Give Me a Second

Greetings.

So about a week ago, I watched this video on YouTube, and it inspired me to think some more on the topic of time travel. The scope of my current views on the subject is very large and underdeveloped, and I'm trying to get this post up in reasonable time, so I won't go into them here. Suffice it to say that my various thought processes led me to the idea of time travel within a simple RC circuit.

This is because much of the talk surrounding potential time travel deals with wormholes in space-time and the possibility of sending something through one. However, all of the scenarios that I have heard described concerning such wormholes only speak of sending something through in one direction. My understanding of wormholes, on the other hand, is that they would operate more like gates, allowing for bi-directional travel. The model of an electrical circuit works very well for this, since charge will flow from higher to lower potentials whichever side of the wormhole they're on, the quantities being discussed are continuous rather than discrete, and there is the potential for both positive and negative voltages. My thought experiment took the following form:


Under normal conditions, the voltage across the capacitor would decay exponentially according to the time constant tau.


However, I would alter the conditions on this particular circuit by introducing a wormhole between the resistors connecting two points in the discharge time: t1 and t2. The wormhole had to be between the resistors because opening it at ground would give me nothing (always at 0 volts) and opening it at the capacitor would effectively and instantly place the capacitor in parallel with itself at a time when it has a lower voltage, and you can't instantly change the voltage across a capacitor. Also, since an instantaneous spike or drop in voltage within the circuit would have little lasting effect (capacitors are often used specifically to get rid of such spikes), I would have to leave the wormhole open for some duration td.

I assumed that the flow of time on either side of the wormhole to be the same, so that t1 corresponded to t2 and t1+td corresponded to t2+td. Therefore, for the period of time(s) the wormhole was open, the circuit would look like this:


where C1 is the first instance of the capacitor, starting at t1, and C2 is the second instance of the capacitor, starting at t2. There is no need to make a distinction between the instances of the resistors, since their voltages and currents can change instantaneously. The starting voltage of C1 would be the typical RC voltage after decaying for a time of t1, and the starting voltage of C2 would be the voltage of C1 after it had decayed according to the parallel "wormhole" circuit for td then decayed naturally for t2-(t1+td).

My first calculations were performed using the values of R1=R2=1kohm, C=1uF, t1=0.5ms, t2=2ms, and td=0.1ms. Solving the parallel circuit required using some differential equations, but overall it wasn't too difficult, and the result came out looking like this:


As you can see, the voltage across the capacitor dropped slightly once the wormhole was opened at t1, then rose back to about normal when the wormhole was opened at t2. There appeared to be a slight difference between the final voltages of the normal circuit and the wormhole circuit, but this difference was small enough that it could be attributed to rounding errors.

To find out whether there was a net effect to adding a wormhole or if it was indeed just a rounding error, I decided to work through the equations again in general form. This is where things started to get ugly. None of the equations simplified, but instead got more and more complex the further I got. I therefore present the result in the form of many constants that require their own definition.

The discharge cycle of the capacitor is divided into five distinct sections:


With constants defined as follows:


(If you're able to simplify things more, please let me know.)

While the complexity of the equations made it difficult to verify if there was a net effect of the wormhole by algebraic means, I was able to plug them into Excel and tweak parameters until the answer became more obvious. First, I lengthened the duration of the wormhole to 0.5ms:


Then I moved the wormhole "closer" to the capacitor by increasing R1 and decreasing R2. This kept the time constant the same while increasing the influence of the wormhole on the capacitor.


At this point it became obvious that there was a net effect to the creation of the wormhole: the final voltage of the capacitor was greater than it otherwise would have been. Since the rate of decay at the end of both the typical case and the wormhole case was the same, this effectively meant that the voltage decay had been delayed by some amount of time equal to


In order to guard against paradoxes, I calculated the cumulative energy output of the capacitor, just to see if the postponed decay was due to the wormhole creating energy or something. This was relatively easy to calculate by finding the voltage across the resistors, using that to find the instantaneous power, then integrating over time.


The result is that the wormhole capacitor has expended less energy than usual. Since the graph of energy is cumulative, this means that the energy expenditure of the capacitor has been delayed, and quick investigation shows that this delay is the same as that for the voltage decay. This means that the total effect of the wormhole is that, without introducing energy into the system, it delayed the event of capacitor discharge.

In other words, I effectively (and temporarily) slowed the passage of time for the circuit. Pretty cool, huh?


Now, these results are hardly comprehensive. For example, I mentioned earlier that I assumed that time flowed in the same direction on either side of the wormhole, and this is not necessarily valid. The typical picture of a wormhole is fold in space-time, and, at least with the 2-D analogy, if you're traveling in one direction on one side of the wormhole, the fold will reverse your direction by the time you reach the other side.


Applying this would mean recalculating the parallel circuit while one of the capacitors is experiencing time in reverse. This is mind-boggling (though I think the results would fit nicer with the whole slowing-down-time thing), but I hope to give it a try. Whether I get around to it, though, is uncertain, as I have a completely different, physics-based project planned for this weekend.