← All Base Form Math projects
BM-07NOT STARTEDBASE FORM · LINEAR ALGEBRAMATHPYTHON

Long-run predictor

Model how a population or a city's migration evolves year by year with a matrix, then find where it settles using power iteration.

EST.5 h
REWARD+100 XP
AFTERoriginal

ML-ARENA BENCHMARKS

YOUR NUMBER VS THE INDUSTRY'S
METRICINDUSTRYMINE
dominant eigenvalue and eigenvector
GOAL · match within 1e-8
numpy.linalg.eig—
no results yet
YOUR RESULTS

Your recorded results appear here.

Brief

Some systems change by the same rule every year. A population with three age classes has births and survival rates. A region has people moving between city, suburbs and countryside. Write the rule as a matrix LL and the state as a vector xx, and next year is xt+1=Lxtx_{t+1} = L x_t. This project asks: where does it end up?

Run it long enough and something striking happens. The total may keep growing, but the shape stops changing: the share in each age class settles. That settled shape is an eigenvector, a vector the matrix only stretches:

Lv=λvL v = \lambda v

The stretch factor λ\lambda is the eigenvalue. For a population, λ>1\lambda > 1 means growth and λ<1\lambda < 1 means decline. For a migration matrix, nobody is created or lost, so λ=1\lambda = 1.

Power iteration is the simplest way to find them: multiply by LL, rescale to length 1, repeat. Any start that has some of the top eigenvector in it turns towards it. How fast depends on the ratio of the second-largest to the largest eigenvalue: the leftover error shrinks by ∣λ2/λ1∣|\lambda_2 / \lambda_1| each step.

EXPECTEDFig. 1
0% 50% 100% 0 10 20 30 year young 72% middle 24% old 4% dashed: dominant eigenvector, λ = 1.5 x(t+1) = L · x(t)
Age-class shares for the objective 1 matrix. They swing, then settle at 72%, 24% and 4%, the dominant eigenvector scaled to sum to 1. Why it's here: Your objective 1 chart should look like this. The swinging is the negative second eigenvalue fading away.
HINT · OBJECTIVE 2
Stuck? Hints stay hidden until you ask.
HINT · OBJECTIVE 6
Stuck? Hints stay hidden until you ask.

DATA · published Leslie-matrix examples

Objectives

0 / 6 CLEARED

Read-only. Log in to update progress.

VICTORY CONDITIONS

  1. Dominant eigenvalue and unit eigenvector match numpy.linalg.eig within 1e-8 for at least three published Leslie matrices, recorded with `python tools/mlarena.py record BM-07 "<largest difference>"`.
  2. Your step counts match the prediction from the ratio of the top two eigenvalues to within a factor of 2.
  3. A chart of age-class shares settling towards the eigenvector, and a sentence on what λ means for that population.

Side quests

Try the Leslie matrix with top row (0, 0, 6) and survival 0.5 and 1/3. Power iteration never settles: explain why, using the eigenvalues NumPy gives.
Add inverse power iteration (solve with your BM-04 elimination instead of multiplying) to find the smallest eigenvalue.

Terms in plain words

Eigenvector
A vector that a matrix only stretches, never turns. Multiplying by the matrix gives the same vector times a number.
Eigenvalue
That stretch factor. For a population matrix, the largest one is the long-run growth rate per step.
Power iteration
Multiply a starting vector by the matrix again and again, rescaling each time. It turns towards the eigenvector with the largest eigenvalue.
Leslie matrix
A population model split by age class. The top row holds births per individual; the entries just below the diagonal hold survival to the next class.
Spectral gap
How much bigger the largest eigenvalue is than the next, often measured as the ratio of the second to the first. A small ratio means fast convergence.