1. 20

    1. 7

      This is a great post, eigenvectors are one of those great mathematical ideas that pop up in all kinds of places.

      I also love this useful bonus tidbit at the end:

      In case you are one of today’s lucky 10,000: the golden ratio is also very close to the conversion rate between miles and kilometers, so you can use Fibonacci numbers to approximate conversions between miles and kilometers in your head. For example, 80km ≈ 50mi. This is a weirdly good conversion – the exact answer is 49.7097mi.

    2. 2

      it seems linear algebra is best explored with a repl nearby

      Kids these days have it too easy… in my day all we had were dusty tomes dryer than tombs, where the diagrams were hand-drawn if you had the luxury of diagrams.

    3. 1

      I found this annoyingly imprecise { ;-) }:

      Even if we pretend that we only care about numbers that can fit in IEEE 754 double-precision floats, we still can’t use this technique to calculate very many Fibonacci numbers, because the floating-point error adds up too quickly.

      So, I wrote a little Python thing:

      def fibIt(n):   # Iterative vs. closed form Fibonacci
        if n < 1: return 0
        prev, curr = (0, 1)
        for i in range(0, n - 1): prev, curr = curr, curr + prev
        return curr
      def fibPow(n):   # Binet (but known to de Moivre & Bernoulli)
          rt5 = 5**0.5 # sqrt(5)
          phi, psi = (1 + rt5)/2, (1 - rt5)/2
          return int((phi**n - psi**n) / rt5)
      from math import log
      for i in range(0, 100):
          if abs(fibIt(i) - fibPow(i)) > 0:
              print("stopped@:", i, "lg(fibIt):", log(fibIt(i),2))
              break   # stopped@: 72 lg(fibIt): 48.82445373396077

      In my experience, it is rare to even see special functions like the log & exp hit <1 ULP. So, having fib get 49/53 bits or whatever..roughly all but the last decimal seems ok. Were there not a cheap, exact method, I’d not even feel disappointed.

      Personally, I think the direct linear recurrence solution is “easier to get” for Binet than the matrix exponentiation stuff, but Wikipedia has both. I guess if you are looking to demo diagonalization & exponentiation then it’s not a bad way. Speaking of recurrences, I always thought Cayley-Hamilton a bit more of a “Dramatic Reveal”, like a stage magic trick.