In these towns, tomorrow’s weather depends only on today’s: tomorrow[i][j] is the chance that tomorrow is weather j when today is weather i. Write long_run_shares(tomorrow): the share of days in each weather over the long run, one share per weather, in the table’s order.
In Sunnyvale, a sunny day is followed by sun 80% of the time and a rainy day by sun 60% of the time. The obvious guess is 80% sunny days. Follow the chances day by day instead, from a sunny first day and from a rainy one: both settle into the same mix, and it isn’t 80/20. The goal is that mix. Your long_run_shares() works it out.
long_run_shares(tomorrow)| tomorrow | tomorrow[i][j] is the chance tomorrow is weather j when today is weather i (a numpy array, each row adds up to 1) | e.g. [[0.7, 0.3], [0.3, 0.7]] |
| returns | the long-run share of days in each weather, in the table's order, adding up to 1, e.g. [0.6, 0.4] | |