Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      27 of 114

      The direction that survives

      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.

      0 tadpoles and 4 frogs. The same rule makes each year’s pond from the last.every year: tadpoles = 8 × frogs · frogs = 0.25 × tadpoles + frogsyeartadpolesfrogstadpoles →frogs ↑shares add up to 1settle(rule, start) → mix ?, growth ×?
      Your functionsettle(rule, start)
      rule2x2 (a numpy array); next year's pond is rule @ pond, a pond being [tadpoles, frogs]e.g. [[0, 8], [0.25, 1]]
      startthis year's [tadpoles, frogs] (a numpy array)e.g. [0, 4]
      returnsmix, growth: the [tadpole share, frog share] it settles on (adding to 1), and its growth per year
      solution.pyLoading Python
      Sign in for an AI hint
      ← How much does it stretch?The best single direction →