A pond holds tadpoles and frogs, [tadpoles, frogs], and every year the same rule makes next year’s pond from this year’s: rule @ pond (frogs lay eggs, some tadpoles grow into frogs, some frogs live on). Run it year after year and the pond’s mix swings at first, then settles; from then on the pond only grows or shrinks. Write settle(rule, start): the mix it settles on, as shares [tadpole share, frog share] that add up to 1, and its growth: how many times bigger it gets each year once settled.
4 frogs move into an empty pond. Each frog’s eggs give 8 tadpoles, a quarter of the tadpoles grow into frogs, and every frog lives on. Year by year on the left; on the right, each year’s pond as an arrow.
settle(rule, start)| rule | 2x2 (a numpy array); next year's pond is rule @ pond, a pond being [tadpoles, frogs] | e.g. [[0, 8], [0.25, 1]] |
| start | this year's [tadpoles, frogs] (a numpy array) | e.g. [0, 4] |
| returns | mix, growth: the [tadpole share, frog share] it settles on (adding to 1), and its growth per year | |