How stock indexes are calculated: price weighting, market-cap weighting, float adjustment, divisors and rebalancing, with a worked example of the index math.