Master Ball

Wrote this in highschool and just recently dug it out.  It’s a parody of a song I quite enjoy Handlebars by the Flobots, if you haven’t heard it, I definitely recommend you give it a listen.  Hope you enjoy this parody just as much.

I can catch Mewtwo with no Master Ball
No Master Ball
No Master Ball

I can catch Mewtwo with no Master Ball
No Master Ball
No Master Ball

Look at me
Look at me
Hands in the air like it’s good to be
ALIVE
And I’m a famous trainer
Even when Team Rocket is all crookedy
I can show you how to breed a Poke
I can show you how to catch em all
I can take apart the Poke Ball
And I can almost put it back together
I can beat a Rydon with a Pikachu
I got no time to waste on you
I know all the words to the Poke rap
And I’m proud to be a master trainer
Me and my friend saw a Lickitung
Me and my friend made a trainer’s book
And guess how long it took
I can catch anything that I want cuz, look

I can beat a gym with no Full Restore
No Full Restore
No Full Restore

And I can see your face on my Pokegear
On my Pokegear
On my Pokegear

Look at me
Look at me
Eight badges say that it’s good to be
ALIVE
In a Pokemon world
All curled up with a Flareon
I can make money open up a gym
I can making a living off a magazine
I can design a Nintendo sixty four
Miles to a chain of a bicycle
I can make new potions
I can make a Ninetails survive aquatic conditions
I know how to run a league
And I can make you wanna buy a Magikarp
Trainers, breeders and gym leaders
I see the strings from a Caterpie
I can do anything with no max potion

I can beat the Elite Four with a level 10
A level 10
A level 10

And I can split the armour of a Skarmory
Of a Skarmory
Of a Skarmory

Look at me
Look at me
Training and I won’t stop
And it feels so good to be
Alive and on top
My goal is Viridian
My team it owns
My Mew unbeatable
My power is pure
I can hand out a million Full Heals
Or let’em all faint in Confusion
Have’em all grilled in a Fire Blast
Have’em all KO’d by a Mega Punch
I can make Team Rocket go to prison
Just because they steal Pokemon and
I can do anything with no permission
I have a Poke Ball in my hand

I can evolve my Vulpix with no Fire Stone
No Fire Stone
No Fire Stone

and I can wake a Snorlax with no Poke Flute
No Poke Flute
No Poke Flute

and I can end the planet in a Hyper Beam
in a Hyper Beam
in a Hyper Beam
in a Hyper Beam

Incremental Variance

I was asked recently about if there was such a formula for an incremental variance, similar to the idea of an incremental mean.  If you knew the average and you wanted to remove or add a data point what was a constant time function to calculate the new average, except with variance.  I personally hadn’t thought of or heard of such a method before, so initially my answer was no.  Since the population variance is defined as \sigma^2 = \frac{1}{n}\sum_{i=1}^n (x_i - \mu_n)^2, for n data points x_i, 1\le i \le n, with population mean \mu_n.  My original intuition was since \mu_n would change, each of the differences would have to be recalculated, but turns out not to be the case.  First step in finding this incremental relation for variance is rewriting the variance formula:

\begin{aligned}\sigma_n^2 &= \frac{1}{n}\sum_{i=1}^n (x_i - \mu_n)^2\\&=\frac{1}{n}\sum_{i=1}^n x_i^2 - 2\mu_nx_i + \mu_n^2\\&=\frac{1}{n}\sum_{i=1}^n x_i^2 - \frac{1}{n}\sum_{i=1}^n2\mu_nx_i + \frac{1}{n}\sum_{i=1}^n \mu_n^2\\&=\frac{1}{n}\sum_{i=1}^n x_i^2 - 2\mu_n\underbrace{\frac{1}{n}\sum_{i=1}^nx_i}_{\mu_n} + \mu_n^2\frac{1}{n}\sum_{i=1}^n 1\\&=\frac{1}{n}\sum_{i=1}^n x_i^2 - 2\mu_n\mu_n + \frac{n\mu^2}{n}\\&=\frac{1}{n}\sum_{i=1}^n x_i^2 - 2\mu_n^2 + \mu^2\\&=\frac{1}{n}\sum_{i=1}^n x_i^2 - \mu_n^2\end{aligned}

Next we define the quantity S_n to be the variance multiplied by the population size:

\begin{aligned}S_n&=n\sigma_n^2=\sum_{i=1}^n x_i^2 - \mu_n^2 \end{aligned}

Finally we take the difference between S_n and S_{n+1} and perform a few fancy manipulations to get a very nice formula:

\begin{aligned}S_{n+1} - S_n &= (n+1)\sigma_{n+1}^2 - n\sigma_{n}^2\\&= \sum_{i=1}^{n+1} x_i^2 - (n+1)\mu_{n+1}^2 - \left(\sum_{i=1}^n x_i^2 - n\mu_n^2\right)\\&= x_{n+1}^2 - (n+1)\mu_{n+1}^2 + n\mu_n^2\\&= x_{n+1}^2 - \mu_{n+1}^2 + n\mu_n^2 - n\mu_{n+1}^2\\&= x_{n+1}^2 - \mu_{n+1}^2 + n(\mu_n^2 - \mu_{n+1}^2)\\&= x_{n+1}^2 - \mu_{n+1}^2 + n(\mu_n - \mu_{n+1})(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + n\left(\frac{1}{n}\sum_{i=1}^nx_i-\frac{1}{n+1}\sum_{i=1}^{n+1}x_i\right)(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + \left(\sum_{i=1}^nx_i-\frac{n}{n+1}\sum_{i=1}^{n+1}x_i\right)(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + \left(\sum_{i=1}^nx_i + x_{n+1} - \frac{n}{n+1}\sum_{i=1}^{n+1}x_i - x_{n+1}\right)(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + \left(\sum_{i=1}^{n+1}x_i - \frac{n}{n+1}\sum_{i=1}^{n+1}x_i - x_{n+1}\right)(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + \left(\left(1 - \frac{n}{n+1}\right)\sum_{i=1}^{n+1}x_i - x_{n+1}\right)(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + \left(\underbrace{\frac{1}{n+1}\sum_{i=1}^{n+1}x_i}_{\mu_{n+1}} - x_{n+1}\right)(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + (\mu_{n+1} - x_{n+1})(\mu_n + \mu_{n+1})\\&= x_{n+1}^2 - \mu_{n+1}^2 + \mu_{n+1}\mu_n + \mu_{n+1}^2 - x_{n+1}\mu_n - x_{n+1}\mu_{n+1}\\&= x_{n+1}^2 - x_{n+1}\mu_n - x_{n+1}\mu_{n+1} + \mu_{n+1}\mu_n\\&=(x_{n+1} - \mu_{n+1})(x_{n+1} - \mu_n)\end{aligned}

But we’re actually not done yet since we still have to isolate for \sigma_{n+1}.

\begin{aligned}S_{n+1} - S_n &=(x_{n+1} - \mu_{n+1})(x_{n+1} - \mu_n)\\(n+1)\sigma_{n+1}^2 - n\sigma_{n}^2 &=(x_{n+1} - \mu_{n+1})(x_{n+1} - \mu_n)\\(n+1)\sigma_{n+1}^2 &= n\sigma_{n}^2 + (x_{n+1} - \mu_{n+1})(x_{n+1} - \mu_n)\\\sigma_{n+1}^2 &= \frac{n\sigma_{n}^2 + (x_{n+1} - \mu_{n+1})(x_{n+1} - \mu_n)}{n+1}\\\end{aligned}
In this case \mu_{n+1} is not currently known, but with the information of \mu_n it can be calculated in constant time. So our entire computation is constant with respect to n.

America

So this site has seen far less updates since I moved to Connecticut for my co-op job.  Just the amount of paperwork, moving, and settling in has set me back in a lot of my personal projects.  I’ve never been a big fan of travel but I thought this would be a good experience for me, since technically I’ve never had to make it on my own.  Even at Waterloo, there was a good handful of friends from my high school that also joined me at the same university.  It made adjusting a lot easier, but I think I may have handicapped myself in the process.  Since they were always there, I tended to lean on them more and take their help for granted.  So here I am, removing myself from the city that I love to reflect and grow on my own.

I built my first computer, I ran my first 8 minute mile and waded through my first flash flood.  I think I’ve learned a lot about a little bit, but maybe the change is more noticeable to me than anyone else.  I can really appreciate how much Waterloo means to me now, and I’m ready to go “hard in the paint” next term.  Don’t worry, I will get the rest of the notes up.

伊藤 清 (Kiyoshi Itō)

“In precisely built mathematical structures, mathematicians find the same sort of beauty others find in enchanting pieces of music, or in magnificent architecture.  there is, however, one great difference between the beauty of mathematical structures and that of great art.  Music by Mozart, for instance, impresses greatly even those who do not know musical theory; the cathedral in Cologne overwhelms spectators even if they know nothing about Christianity.  The beauty in mathematical structures, however, cannot be appreciated without understanding of a group of numerical formulas that express laws of logic.  Only mathematicians can read musical scores containing many numerical formulas and play that music in their hearts.” -K. Ito, My Sixty Years in Studies of Probability Theory

I thought 10 years was a long time. I am but a small blip in time compared to the eternity that is Kiyoshi Itō.  I can only hope that I too can find something that worthwhile to dedicate 60 years of my life to.  I’m a sucker for great quotes, and I guess my professor shares the same sentiment.  Whenever we start a new topic he usually pulls up some quotation to make the material more relevant.  This time it was Stochastic Calculus and he gave a shout out to his boy Itō.  Ironically this is the class that probably introduces some of the most difficult material but does not properly build up the background necessary to fully understand it.  It’s a real shame since most students in that class just see it as bashing properties until you’re blue in the face, and they’ll never understand just how elegant those results are.  I don’t claim to be any better, there are times when I do give up on trying to understand and default to rote memorization.  I have found that this is a terrible idea and it is strictly better to understand so you can build that foundation.  The problem is that understanding takes a great deal of time and with the pace of university courses, sometimes it’s not realistic that you can do this with your entire course load.  I could probably go on and on about the education and learning of mathematics, but that’s not the point of this post.

What this quote really got me thinking about is it only mathematicians that can appreciate mathematics?  I think this is true, especially for the most pure areas of mathematics.  There has to be that element of self discovery before you can realize why a particular result is beautiful.  If you have experience in mathematics but not in a certain area, I will agree there are some parallels that can be drawn.  However to someone who does not study mathematics explaining these concepts in laymen’s terms to them is almost an impossible task.  For the more applied fields in mathematics, I believe that the general public is more concerned with the applications of the results derived, as opposed to the actual machinery and how it was developed.

This is not to say that other disciplines do not require an equivalent amount of technical ability or dedication.  But it is possible to not be a painter and still judge whether or not a piece of art is pleasing to the eye, or similarly to not be a musician and tell if a melody sounds great.  I haven’t quite found a subject like math where unless you study it, you cannot make any sort of sound judgement, and your intuition can often mislead you.

Valentine’s Day

With February 14th rolling around soon, most of you know what’s coming up.  I’m not too interested in the history of holidays but I think they each bear significance, since they act as a reminder to be thankful for those important people in your life.  In my rush to be successful, I often forget the contributions my family and friends have made to shape the person I am today.  I also find it a difficult task to reciprocate everything that they have done for me.  No gift could be adequate, so I am usually at a loss of how to express my gratitude when these holidays show up.  I didn’t really gain any insight to the whole gift thing until I was forced to for that special someone.  I tried my best to incorporate everything that made me who I am in to a hand made gift.  Honestly it was probably the best reaction to anything I’ve ever given.  The sentiment of a present I made myself is probably the closest I could have gotten to distilling the thought of, “This is me, thank you for being such a big part of that”.

To all of you who I have had the fortune of meeting in my lifetime, thank you.  Even though it is difficult to show, I promise I will return the favour you have shown me.  Have a great Valentine’s Day, and here are some neat relations you can give to that special someone to graph.

r=1-\sin(\theta)

1

x^2+\left(\frac{5}{4}y-\sqrt{|x|}\right)^2=1

2

r=\frac{\sin(\theta)\sqrt{|\cos(\theta)|}}{\sin(\theta)+\frac{7}{5}}-2\sin(\theta)+2

3

(x^2+y^2-1)^3=x^2y^3

4

\left(x^2+\frac{9}{4}y^2+z^2-1\right)^3=x^2z^3+\frac{9}{80}y^2z^3

5

Term In Review

Regular updates my ass.  They say never to make promises you can’t keep, but those are the best kind.  The last month has been one of the most stressful times in my life.  People say “they’re just exams, why are you getting so worried”.  But I’ve come to realize that marks matter.  A lot.  For someone like me who’s already has a lot of black marks on his transcript, I have an even smaller margin for error.

A nobody like me.  No connections, no credible work experience, average grades.  In order to create new opportunities, I can’t afford to screw up.  Is it not reasonable to be afraid, if your future was determined by what numbers you earned?  I am.

“If you love what you do, you’ll never work a day in your life”, is a saying I hear a lot.  There’s very little truth to the statement I have a found.  It trivializes the amount of work you have to put in to achieve something.  Work is work, you may enjoy the majority of it, but I highly doubt anyone loves every aspect of what they do.  This is truly a saying for those who have already earned their spot in life, with blood, with sweat, with tears.

This term has been tough.  I have learned the true meaning of hard work and sacrifice.    You’ll have to give up that other thing you enjoy, time with friends and family, sleep, just so that you can remember one more theorem or finish one more problem.  The only thing that keeps me going is the memory of why I came here in the first place.

In the end, marks are just numbers on a piece of paper.  I can only hope that they create the opportunity for me to tell my story.

St. Petersburg Paradox

Here’s a pretty neat problem which shows why expected value is not always a great measure to go by on it’s own.  Suppose that I initiate a game with you.  I toss a fair coin and every time it comes up heads I first pay you a dollar, then I double the payment on the next toss.  So the first payment will be 1, then 2 on the second toss, 4 on the third and so forth as long they come up heads.  On the first toss that is a tails, I stop paying you and the game is over.  The question then becomes what is the amount that should be paid in order to play this game.

If I just calculate the expected value of the gamble it turns out to be:
\sum\limits_{k=0}^\infty 2^k\cdot\frac{1}{2^{k+1}}=\sum\limits_{k=0}^\infty \frac{1}{2}=\infty

So then I can expect to win an infinite amount of money from this game, so I should be willing to pay the same amount right?  As it turns out, that’s a pretty silly idea.  When most people are asked to play this game they quickly turn it down if you raise the amount any higher than 5 dollars.  So what is the discrepancy between what the measure is telling us and what we actually want to do?

Many people have worked on this problem, and the answer I like the best is that this measures the expected value of the money gained, not the value added by the gamble.  So instead we need to take the probability weighted average of the value added instead of just the dollar amount.

Every person has different risk aversion.  Therefore we define u(x) to be some utility function, where and x\in\mathbb{R}.  This measures the value added or lost by some change in dollar amount x.  If the person you are dealing with is not rational, then their utility function can be pretty hard to pin down, but for most people there is some pretty convincing reasoning to describe the behaviour of u(x).

  1. u(x) is an increasing function of x.  Who doesn’t like more money?  More money should add more value.
  2. \lim\limits_{x\to\infty}u'(x)=0.  You like more money, however the value generated by that money becomes smaller and smaller if you are already very rich.

So now the sum converges probably to something more reasonable as we take this average:
\sum\limits_{k=0}^\infty u(k)\cdot \frac{1}{2^{k+1}}=C

The problem now becomes what is someone’s utility function so we can figure out exactly how much they would pay.  As far as my knowledge goes, I couldn’t tell you how to calibrate such a function, but it’s something cool to think about it.