July 26, 2007

Math: For Programmers and in Everyday Life

Category: Personal development,Software development — by Amit Chaudhary @ 7:07 am

I knew the Math basics needed for choosing algorithms when programming, this is the simple stuff, mostly Big-O notation and comparision of O(N logN), O(N), O(N*N), etc. Two events in late 2006, early 2007 gave Maths more prominence for me.

One was reading the convincing argument by Steve Yegge I consider to be Uberdev.
Steve Yegge’s Math Every Day, Written in November 15th, 2004 when he was at Amazon.com

I just read a book called John von Neumann and the Origins of Modern Computing. Every few years I read a book that causes a discontinuity in my thinking — a step function that’s a lot larger than the little insights that most books or articles produce. For me, this was one of them.

Math is a funny thing; it’s not the way most people think of it — it’s an ever-expanding set of tools for modeling and solving problems. It’s very much driven by practical considerations; if a new problem comes up, and it’s not tractable to existing mathematical methods, then you work to make up new ones.

My new motto is “Math every day.” I’m giving myself one year to master all the math I was supposed to have learned in high school and college: algebra, geometry, trigonometry, limits and conic sections, differential calculus, integral calculus, multivariate calculus, simple differential equations, linear algebra and eigenvectors/eigenvalues, discrete math and logic, probability and statistics. I “knew” it all at one time or another, without really understanding what the heck it was for, so I should be able to put it all together again fairly quickly, if I put my mind to it.

Although I have not yet taken it to his level, I started keeping an open eye and learning approach to any Math I encounter.

Second was Google interviewers asking Math (Probability puzzles among others), See the birthday wager question at Shmula’s Google interview article. I have since realized that Discrete Mathematics is a prerequisite for some fields such as Data Mining and Machine Learning which matter for Internet companies such as Google, MSN, Yahoo & Amazon.

Interestingly, soon I started noticing more math in my day to day life, typical it tends to be Combinatorics (Permutation & Combination) and Probability. Here are a few actual life examples from the last 6-9 months:

  • Dilemma of the Garage door repairman

Our Garage door stopped working (would not open or close), so we get the Garage door repairman. He installs a new opener, but forgets the combination. He says their are millions of combinations and he will never get it even if it tried.

He shows it to me and if you look inside the Garage door opener (which one typically uses from their car), there are nine pins with each having two positions. Soon enough, it clicked to me, it maps neatly to a 9-bit integer value. The total possible values is 512 (2^9) which though a lot, is much less than millions.

  • A Bet against real estate median price rise

I rarely bet, but earlier in 2007 I took a bet against Seattle area (King County SFH, Single Family Home, to be precise) rising more than a certain percentage (one percent) in year 2007. I am now on track to probably lose this bet.

It seems logical during that time including the fact that real estate sales were falling and so on. So what happened? Primarily, I was just wrong in my understanding of the issues. However, also affecting it was the fact that the weightage changed. Median as you probably know implies half of the quantity is above that number and half are below. In recent months, sales for lower priced cities in King County have been dropped as a percentage of the county. This skews the balance, making it a much higher probability bet, now most cities SFH would now need to drop.

  • A Bet against India not winning the Cricket World Cup

Later on, a friend of mine to bet that India (the country where I was born and whose Cricket team I sometime follow) will win the Cricket World Cup. The weightage in this bet was the capability of the team, however the Indian Cricket team unlike, say the Australian is not head and shoulders over the rest. So with a no weightage scenario, this was a one team out of sixteen making it, I was getting 1:1 odds for a probability event of 15/16. I took it. And won. A good resource on making sense of odds: Figuring the Odds, Probability Puzzles.

  • How many confirmation numbers can Southwest airlines really give out

I noticed that all Southwest airline tickets are uniquely identified by a confirmation number which has six characters and contains numbers and alphabets. An example is CZ6H55. I was wondering how big is this space or rather how many confirmation numbers can Southwest airlines really give out, considering it is one of bigger domestic airline?

This is a case of permutations (changing positions of same numbers results in different confirmation numbers), each position can have 36 (26 alphabets + 10 digits) values and repetitions are allowed (DDDDDD should be valid.) The formula for this is 36 * 36 *…6 times = approx 2 billion.

The result of math behind finding people with same birthday (See below) still surprises me as does the infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type or create a particular chosen text, such as the complete works of William Shakespeare. Interestingly, as the wikipedia entry says. The probability of a monkey typing a given string of text as long as, say, Hamlet is so infinitesimally tiny that, were the experiment conducted, the chance of it actually occurring during a span of time of the order of the age of the universe is minuscule but not zero.

If you are interested in the probability question that Shmula was asked at Google and the response, my take is below:

Question:

you are at a party with a friend and 10 people are present including you and the friend. your friend makes you a wager that for every person you find that has the same birthday as you, you get $1; for every person he finds that does not have the same birthday as you, he gets $2. would you accept the wager?

My answer with explaination:

One way to look at it, for me to make money, out of 8 people, 6 or more would need to have birthday on same day as me, and 2 would need to be different.
or it is giving me odds of 2-to-1 (Odds =, if T is total, t1-to-t2, here t1+t2 = T, see dice case below for example)

Using above logical possibility #2
The odds that six people have their birthday on same date as me is
=1 – (364/365 * 364/365 * 364/365 * 364/365 * 364/365 * 364/365 )

=1 – (0.99726027 *0.99726027 *0.99726027 *0.99726027 *0.99726027 *0.99726027 *)

=1-(0.98367382)

=0.01632618

The odds seem to be 1 in 100 that I will make money with the above deal. So, I would not accept the wager if making money on it was my intention.

A variation, the chance that 1 person out of 25 in a party shares his\her birthday with me is (See details below)

~= 0.50

and out of 50, it is almost a surety

~= 0.97

For the probability background for above problem, I would suggest reading: Math Forum, Ask Dr. Math: Probability When to Add, When to Multiply?

And on a lighter note, here is a new way to learn maths, New Math (Tom Lehrer) Animation

• • •

July 25, 2007

On Cash Incentives or Bonuses, Regular & Extremely High, My thoughts

Category: Work — by Amit Chaudhary @ 1:12 pm

Regular kind of Bonuses

The Regular kind of Bonuses are typically 5-30% of the annual salary  and given as part of an employee’s annual performance review. These are quite an important component of Compensation package at most Computer Companies including Brocade, Microsoft, Yahoo, Amazon, and so. My thoughts:

  • These make sense from the point of view of the company, the same employee will perform differently during their career, many times this is due to temporary circumstances including a new hobby (Car racing, Bikes, Flying, etc), Personal life changes (Marriage, Children, Illness, etc) or simple variations in motivations. Bonuses allow a company to reward them accordingly.
  • From an employee’s point of view, it makes sense too as part of the Bonus comes from the company meeting it’s financial objectives, thereby increasing them during good times. A counter point is to give more weight to the Salary component of the Compensation to ensure you are sufficiently paid during the down times due to industry changes, an off quarter or mis-execution at higher levels.

Extremely High kind of Bonuses

The Extremely High kind of Bonuses, in my knowledge, are\were only given at Google in form of Founder awards, these are\were rumored to be $1million+ which makes them 1000% of a typical software developer’s annual salary and were given to high impact projects including Gmail, Google Desktop, Google IPO, etc. My thoughts:

  • It made sense from Google’s point of view, from what I know, the whole company is kind of many startups running inside a large company. Engineers can go and join any group (Search for “switch teams” in Steve Yegge’s article: Good Agile, Bad Agile), so it comes to being very good and being in the right startup, err group to be successful.
  • I won’t be surprised if Google still continues the Founders awards, only they are super secret now.

More views on the Incentives topic:

1. Marc Andreessen, one of creators of Mozilla and Netscape browsers writes in The Pmarca Guide to Big Companies, part 2: Retaining great people

Don’t do arbitrary large spot bonuses or restricted stock grants to try to give a small number of people huge financial upside.

An example is the Google Founders’ Awards program, which Google has largely stopped, and which didn’t work anyway.

It sounds like a great idea at the time, but it causes a severe backlash among both the normal people who don’t get it (who feel like they’re the B team) and the great people who don’t get it (who feel like they’ve been screwed).

I agree that the situation in the last statement might happen, but do not believe it is a reason not to do it. It is no different from one person being successful with a startup versus another one not being.

2. Joel Spolsky’s view point: Incentive Pay Considered Harmful

if you do have any choice in the matter, I’d recommend that you run fleeing from any kind of performance review, incentive bonus, or stupid corporate employee-of-the-month program.

• • •

July 22, 2007

A call for South Asian Bone Marrow Donors

Category: Life,Spiritual — by Amit Chaudhary @ 7:20 pm

Today while visiting an Indian Restaurant in Redmond, WA (Spice Route, a very good one, try the Veg Chettinaad Curry or the Paneer Tikka Masala) I saw a poster requesting South Asian (Indian, Pakistani, Sri lankan, Nepali, Bangladesh, etc) Donors for Bone Marrow. It was a variation of the one below.
South Asian Bone Marrow Donor Registration Drive 2007

How to register?
The process for registration involves taking a two second check swab. If a match is found, some more tests are done. For the actual bone marrow transplant, from the HelpVinay FAQ.
Peripheral blood stem cell collection

(MOST current and common method)…..You are given small injections of Neupogen/Filgrastin for 3 to 5 days to force your marrow to overproduce marrow or stem cells which are then released into your circulating blood. The stem cells are collected by removing blood from a vein in your arm, passing it through a filter system, which collects the stem cells and returns the remaining blood to you…a 2 to 3 hour procedure.

Where to register?

Find a drive happening close to your location using

For people around Eastside, there is a drive happening on the Microsoft Campus from July 23-July 27 2007

07/23/2007 – 9:00am, 07/27/2007 – 5:00pm
Microsoft Campus
One Microsoft Way (various buildings throughout campus)
Redmond, WA, 98052
United States

See map: Google Maps

Contact Person: Sandip Shahane: sandipshahane at yahoo.com; (425) 894-5153


• • •

July 2, 2007

Articles on becoming Great. The key: Time, Smart Hard work & Visualization

Category: Personal development,Work — by Amit Chaudhary @ 8:36 pm

I recently read articles on on becoming Great. The key: Time, Smart Hard work & Visualization

Fortune October 30, 2006, Secrets of greatness: Practice and Hard work bring success

Summary:
1. Expect it to take 10 years.
2. Be ready to work with focus on measured improvement, regularly and harder than all,
3. Visualize or create a mental model of Goal\Success.

Excerpt:

1. Ten years to become world-class
Reinforcing that no-free-lunch finding is vast evidence that even the most accomplished people need around ten years of hard work before becoming world-class, a pattern so well established researchers call it the ten-year rule.

2. On Deliberate Practice
The best people in any field are those who devote the most hours to what the researchers call “deliberate practice.” It’s activity that’s explicitly intended to improve performance, that reaches for objectives just beyond one’s level of competence, provides feedback on results and involves high levels of repetition.

For example: Simply hitting a bucket of balls is not deliberate practice, which is why most golfers don’t get better. Hitting an eight-iron 300 times with a goal of leaving the ball within 20 feet of the pin 80 percent of the time, continually observing results and making appropriate adjustments, and doing that for hours every day – that’s deliberate practice.

3. Consistency is crucial

As Ericsson notes, “Elite performers in many diverse domains have been found to practice, on the average, roughly the same amount every day, including weekends.

That’s a lot to focus on for the benefits of deliberate practice – and worthless without one more requirement: Do it regularly, not sporadically.

For most people, work is hard enough without pushing even harder. Those extra steps are so difficult and painful they almost never get done. That’s the way it must be. If great performance were easy, it wouldn’t be rare.

4. Adopting a new mindset
Armed with the improving mindset, people go at a job in a new way. Research shows they process information more deeply and retain it longer. This difference in mental approach is vital. For example, when amateur singers take a singing lesson, they experience it as fun, a release of tension. But for professional singers, it’s the opposite: They increase their concentration and focus on improving their performance during the lesson. Same activity, different mindset.

5. Mental models of your business aka creative visualization
Andy Grove could keep a model of a whole world-changing technology industry in his head and adapt Intel (Charts) as needed. Bill Gates, Microsoft’s (Charts) founder, had the same knack: He could see at the dawn of the PC that his goal of a computer on every desk was realistic and would create an unimaginably large market. John D. Rockefeller, too, saw ahead when the world-changing new industry was oil. Napoleon was perhaps the greatest ever. He could not only hold all the elements of a vast battle in his mind but, more important, could also respond quickly when they shifted in unexpected ways.

Creating Passionate Users: How to be an expert

Summary:
Creating Passionate Users: How to be an expert Summary

• • •
Powered by: WordPress Theme based on Sharepoint like theme from: ADMIN-BG