There was an error in this gadget

Wednesday, December 8, 2010

Surprises boletoh.. MATLAB

MATLAB (for matrix laboratory) is a widely used numeric computing software. It has gained tremendous popularity in recent years due to the numerous toolboxes and internal modules available.

All great coders have their quirks and leave a hidden anomalies in the work ( I am sorry Bill, this has no reference to the blue screen in PC's).  Mathworks programmers are no different and have left a few "Easter Eggs"

1.  The spy
SPY(S) plots the sparsity visualization pattern of the matrix S. For example a 3X3 Identity Matrix would give:

So what happens if you give SPY without any argument ?

2.  The Game of Life

Conway's game of life is a rule based game an an interesting application of cellular automata. In this game every cell follows the below four rules:
  1. Any live cell with fewer than two live neighbors dies, as if caused by under-population.
  2. Any live cell with two or three live neighbors lives on to the next generation.
  3. Any live cell with more than three live neighbors dies, as if by overcrowding.
  4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
You start by "seeding" a few cells and simulate the game. There are interesting patterns like gliders, guns etc.. that emerge  and stabilize. For more details see game of life wiki or play it online at game of life online

Entering "life" in the matlab command prompt pops up a demo....

 The file PENNY.MAT contains measurements made at the National Institute of Standards and Technology of the depth of the mold used to mint a U. S. penny.

Type "penny" in the command prompt:

 4. Image

Matlab has a really good imaging module, but a really spooky default image. Wonder why ? Just input "image" in the command window

4. Hallelujah
This one is my favorite quirk in Matlab. I will not reveal much here, just go and try it out yourselves. Type:

 load handel

Cool right ?

5. Finally some philosophy:
Ask Matlab "why" and it will give you a random reason. There are several of them, and here's a sample list which i got by running a simple for loop on 'why". They are hilarious !!!

For the approval from the hamster.
To please me.
The customer is always right.
She obeyed the mathematician.
Joe suggested it.
Because Loren wanted it.
For the love of me.
The hamster wanted it.
Because a tall mathematician suggested it.
For the approval of her.
To fool me.
He wanted it.
She wanted it.
A not excessively good and bald very young mathematician helped a rich and bald and young and smart and tall and young smart bald and very smart and young and young and tall system manager.
For the approval from her.
To fool a young good rich hamster.
Loren obeyed the mathematician.
Bill obeyed a good engineer.
The smart and smart kid insisted on it.
She wanted it that way.
He wanted it.
The terrified and smart bald and smart and not excessively smart not very good engineer told me to.
For the approval from Jack.
A good and smart not very rich engineer asked the bald and good and young and young kid.
She insisted on it.
Because the good and smart smart smart and tall kid told me to.
Some bald very terrified kid wanted it.
The programmer suggested it.
Bill wanted it.
A terrified system manager obeyed some not excessively good and terrified tall very bald kid.
Because they obeyed me.
He wanted it that way.
Don't ask!
Because Pete wanted it that way.
He wanted it that way.
Don't you have something better to do?
A tall hamster insisted on it.
You told me to.
Loren told me to.
The rich system manager knew it was a good idea.
To fool some not excessively smart kid.
Because a engineer insisted on it.
The good mathematician told me to.
The not very tall system manager told me to.
The terrified system manager told me to.
The young engineer knew it was a good idea.
Some very smart not very smart tall and smart and tall programmer helped a system manager.
They wanted it that way.
Bill told me to.
Joe knew it was a good idea.
They obeyed some engineer.
To satisfy the bald hamster.
The computer did it.
To fool the rich programmer.
To satisfy some tall hamster.
Because Pete told me to.
Bill wanted it that way.
A smart mathematician obeyed a terrified mathematician.
Why not?
It's your karma.
For the love of Loren.
He wanted it that way.
Jack helped some hamster.
To please the mathematician.
A young not excessively good mathematician told a engineer.
To please the tall smart mathematician.
She threatened a rich and terrified system manager.
A smart and smart and smart system manager helped her.
To fool a system manager.
For the approval from the kid.
Joe suggested it.
They wanted it.
The system manager helped some smart system manager.
She told me.
To fool a very bald and not excessively young mathematician.
For the approval from all.
A not excessively good and good mathematician insisted on it.
Some young and terrified and very bald and very bald and not excessively bald and very terrified and tall and bald smart kid told the programmer.
For the love from her.
Jack obeyed a good and young and good hamster.
A good and not excessively terrified and rich engineer suggested it.
They suggested it.
To fool a terrified system manager.
The computer did it.
Loren obeyed some bald mathematician.
She suggested it.
Some mathematician knew it was a good idea.
Some system manager wanted it.
The good very terrified system manager suggested it.
She insisted on it.
Jack suggested it.
A mathematician knew it was a good idea.
Don't ask!
For the approval from a very young programmer.
The very good and terrified and good and good programmer wanted it.
For the love from him.
To satisfy a programmer.
For the love from her.
He told me to.
Don't you have something better to do?

There were several other funny quirks, which have been removed from MATLAB ( due to some pressure from snobby corporate managers i am sure). So have fun before you update to the next version and  these eggs are gone forever.



  1. Sweet discovery man....This just shows how much time your spending on these softwares. Geek!!!!

  2. 323 page views! nice work dev! did you put the goldfish mouse follower in yourself?

  3. Nah..that is a widget that is available already

  4. Hi! There is a lot more to discover in the image easter egg - see:

  5. Tish, thats cool.. I did not know it had so much history to it. Thanks :)

  6. also:

    load train

  7. Are you sure about spy? Woof!