Thursday, November 28, 2013

Discipline

     I remember in social psychology learning about willpower as a muscle*. One study had participants doing some very boring and repetitive task, like placing pegs in different holes. After this initial task the participants were asked to solve a complicated geometric problem. The control group, who didn't have to do the initial task, worked longer on the geometric problem, while the other group gave up earlier. This showed the depletion aspect of willpower. In another study they had participants practice doing things that required willpower throughout the week. At the end of the week they had to solve some sort of puzzle and performed better on this task than the control who did not practice during the week. This showed the strengthening aspect of willpower.
   
     I've been thinking a lot about willpower as a muscle the last couple days and how this concept relates to sailing. Our season ended this fall on a disappointing note: the coed team didn't qualify for the Atlantic Coast Championships, the first time in something like 13 years. At the time our team was ranked 6th in the country so this was a big blow, and I felt a lot of the weight on my shoulders as the top skipper on the team. When it was over our coaches emphasized the need for a sense of urgency, a kind of fired-up attitude. To someone not in the sport the speech would be understood as: try harder.
   

     Sailing is odd because it combines the mental aspects of golf with the tactical and strategic elements of chess, to which it adds the the technical aspect of any other sport. Can you imagine someone telling a golf player they needed to try harder to make a shot? Or a chess player that they needed to try harder to outsmart the other player? No, clearly a different sort of effort must be made to improve in those disciplines.
   
     Willpower will take your game to the next level. Thinking back, at the end of the last school year I had that sense of urgency my coaches were talking about. I was fired up- angry, frankly- and felt I had no time to waste. I gathered a selection of my dad's sailing books and set to work reading them. I was determined to get better, and I did. The books definitely helped, as did sailing a few days a week every week, but what I think really made the difference was that I flexed my willpower muscle everyday. In my fired-up state I forced myself to do every task that needed to be done as soon as I could. Tax forms, emails, working out, whatever- as soon as the thought popped into my head I did it. In other words, I exercised my willpower, and I got stronger. This lasted throughout most of the summer, until I became complacent. At the end of the fall I was certainly "trying" as hard as ever, but something just wasn't the same.
 
      A lot of sailors, and people from other sports for that matter, have said something along the lines of "I know what to do but for some reason I don't do it" at some point in their recreational careers. This fall I said that exact line after doing something particularly dumb in practice. After replaying the race in my head I observed that I had an internal voice that was telling me all of the right things to do ( "we should step back out to the left side, we're over-leveraged in the middle") and a second voice that raised doubts or gave alternative decisions. What I've just realized is that that first voice you hear when sailing is the same voice involved in willpower. When a thought pops in your head that says "I should do my laundry" and you do it, that builds the same strength used to make the right decision in sailboat racing.
   
      Some may be wondering why you need anything but instinct to make the right decision in sailing. The answer is that for most situations you don't. For good sailors the right decision comes naturally. But the hard decisions require discipline, especially when the ego's involved. A simple example would be covering 2 boats on the last beat coming in to the finish. A voice in your head says "there's no way you can cover both boats if they split sides, pick one to cover and stick with it". Instead of listening you decide that actually there is really good breeze in the middle and you think you can catch both the left and right shift. You catch neither, and both boats pass you. With discipline the decision becomes easy: pick one boat and don't worry if the other beats you as you can't control the breeze.
     As I wait for the start of the spring season I will be training both my body and my mind.

Flex that willpower muscle, through discipline watch it grow

* Doing some research I came across a blog that had some interesting objections to the depletion aspect of willpower. Check it out http://www.epjournal.net/blog/2011/08/willpower-is-not-a-resource/

Wednesday, November 27, 2013

Rock Paper Scissors Lizard Spock

       So I'm enrolled in a Python programming course on Coursera and just finished my first project! I haven't really been working on this class due to my time constraints from my actual classes at Brown and from sailing, but now that I'm on break I thought I would give it a shot. The program is really simple: it plays a round of Rock-Paper-Scissors (just realized my code uses the word "Scizzors" not scissors, really need to work on my spelling)-Lizard-Spock with you.
       For those who don't know RPSLS is an expansion of rock paper scissors made popular by the T.V show The Big Bang Theory. I used Code Skulptor to write and execute my code, and it's saved through their website. To play a game of RPSLS, just scroll down to the end of the script. At the bottom there is a line that says:
rpsls("Spock") 
     To play the game just replace "Spock" with any of the 5 words (or just leave it as Spock). This is what you choose to throw. Then click the run button, which is a triangle shaped button in the upper left corner. The computer will randomly pick one of the five throws and show you who won.

Not the coolest thing in the world but it's a start.
Here's the link:

http://www.codeskulptor.org/#user26_SeeLm0xDrq_2.py

Traffic

    Is traffic an unavoidable consequence of our transportation infrastructure? Couldn't there be a more efficient way to get cars from here to there? I certainly don't know the answer to this question, but often let it distract my mind while I'm in some bumper to bumper congestion. The other day after getting my skates sharpened I was led on a detour goose chase on my way back to the highway. The pack of cars I was stuck with followed the signs as we made over 10 turns, even though we only hundreds of feet away.

        I tried to think of an algorithm that would get us going in the right direction faster. Maybe some sort of large scale linear program, in the style of game theory. Each car would choose his best possible route based on the most likely decision of the other cars in the area. It doesn't seem like that scenario is too futuristic, as cars doubling as WiFi hotspots are becoming mainstream. Soon cars will be able to talk to each other and will operate on a virtual grid. Once we have autonomous cars optimization becomes a real possibility. Google's self driving car has been on the road for over a year now. Of course, the security concerns with allowing our vehicles to have their own internet and be autonomous are serious. Hopefully by that time encryption outruns clever hackers.
 

Monday, November 25, 2013

Simulation of Random Homework Assignment Problem

I simulated the random assignment on Matlab for a few cases:



The convergence is similar no matter how many students there are. The error after 1000 trials (I used Error=|average-1|) hovers around 0.02 regardless of the number of students.

Sunday, November 24, 2013

Moral Price Discrimination

   I just read The Armchair Economist by Steven E. Landsburg which was supplemental to the Microeconomics textbook I use for class. I'd definitely suggest it to anyone who has an interest in economics but is more of a beginner. Or you can check out his blog The Big Questions.A word of caution should be advised as Landsburg is very contrarian in his work and some of the ideas presented will definitely offend some people. I don't know enough about economics to support or criticize his ideas, but I really enjoy how they make me think.

       One of the big ideas of Microeconomics is price discrimination. The way I understand it, price discrimination works by transferring some of the consumer surplus to the producer. It does this by charging higher prices for a good to people who are willing to pay higher prices, and lower prices to people who would only buy the product at lower prices. If the price were higher but constant, the low-price people would not buy the product at all.

      One of the examples in the book was a company (can't remember which) that sold both a high speed and low speed printer. It sold the high speed version for $1500 (this was the 90's I think), and then it added a device that made the printer slower and sold that version for $1000. The two versions cost exactly the same to produce, yet one had been made intentionally worse and sold for a lower price. The people who wanted a high speed printer and had the money would buy the more expensive version, while the people who were more uncertain about either their need or ability to buy a printer would buy the cheaper version. The company makes more profit this way than it would by selling only the high speed one at either $1500 or $1000. Interesting. Price discrimination is everywhere if you look for it. Airlines do it regularly (ever wonder why a ticket for a connecting flight costs less even though the distance the plane takes you is longer than a direct flight?), as do colleges (if both tuition and financial aid are rising, what does that tell you?).
     
      Anyway I was at the grocery store the other day and stopped for a bit to look at the egg selection. Most of the eggs were from a company called Little Rhody's, while the rest were from a larger brand name. Little Rhody's was selling 6 different types of eggs. There was Large White Eggs ($2.59)*, Extra Large White ($2.79), Large Local Eggs ($2.79),  Extra Large Local ($2.99), Jumbo Large Local ($3.19), and Vegetarian Fed Large ($3.19).

       In order for a company to price discriminate they must have something resembling monopoly power (or else competitors will compete the high price down), and the product must not be able to be sold once it is bought (the people who bought at the low price would just resell the product at a price between the low price and the high price). So two things to consider: the grocery store was mostly dominated by Little Rhody's brand, and I doubt anyone would buy eggs from a stranger on the street. Then is this price discrimination? For sure some of the eggs do cost more to produce, as larger eggs must be produced by larger hens who eat more food, but how much of that extra cost is production cost and how much is discrimination? Does vegetarian feed cost that much more?  There was also cage-free eggs from the other brand that cost something like $3.49. I think I can see how extra production cost accounts for the price disparity in this case, but what about local eggs vs. outsourced eggs? Kind of makes you think about whats truly going on when we choose more ethically minded products.

     Sometimes I think that half the reason to buy any product that is "ethical" or "green" is because it costs more. If the more "ethical" product cost the same as the other choices I'd probably still buy it, but would I feel as good when I'm eating the eggs? Did I do my good deed for the day? Is it still morally right if I do something only because it gives me a release of dopamine?

I bought Extra Large Local.




*Most of these pries I remember well, while a couple are best guesses






Hey

Seeing as my writing has dropped to a high school level, I figured it was time to start a blog. That's what all of the experts suggest, right? I've been taking almost strictly math and science courses while at Brown, and right now it's really hard for me to convert thoughts into words. For the time being I will post here about whatever I'm working on or thinking about, without any particular rhyme or reason. Right now my particular interests are competitive sailing, mathematics, coding, weight lifting, and maybe a little bit of meditation. So to start, two things:

1) As soon as I created the blog I had two views, and one was from Alaska. How cool is that!

2) I was discussing what I think is my favorite probability question with a friend a few days ago:

A teacher is returning graded tests to her class of n students, none of which are labelled with a student's name. If she returns the tests at random, what is the expected number of students who get the correct test?

    \operatorname{E}[X] = x_1p_1 + x_2p_2 + \dotsb + x_kp_k \;.

Here expectation refers to the expected value, which is the sum of every value that the random variable X can take on, multiplied by the probability of obtaining that value.

For instance: flip a fair coin twice, what is the expected value if the value of heads=1 and tails=0?
E(X)=(0)(1/4)+(1)(1/2)+(2)(1/4)=1

I'm a little rusty on my formal probability, so I will just do this problem for a couple of cases, instead of proving it for the nth case.

Say that n=2:
then the E(X)=(0)(1/2)+2(1/2)=1
The probabilities here are determined as such because they only depend on the first person. If he gets the right test (P= 1/2) then the other person also gets the right test.

for n=3:
E(X)=(0)(1/3)+(1)(1/2)+(3)(1/6)=1
The trick here is that it's impossible to get 2 tests right and 1 wrong.

n=4:
E(X)=(1)(1/3)+(2)(1/4)+(4)(1/24)=1
(Using nCr/n! for probability of 2)


It's easy to see that this generalizes to the nth case (which is proved by linearity of expectation if I recall right). So no matter how many students the teacher has, she is expected to return just one test right!

Governing dynamics.