Dynamic Programming

If we try to evaluate memoized_fib(10_000), we get a strange error:

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in <cell line: 1>()
----> 1 memoized_fib(10_000)

/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in memoized_fib(n)
      7     return n
      8 else:
----> 9     return memoized_fib(n - 1) + memoized_fib(n - 2)

/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in memoized_fib(n)
      7     return n
      8 else:
----> 9     return memoized_fib(n - 1) + memoized_fib(n - 2)

    [... skipping similar frames: memoized_fib at line 9 (1483 times)]

/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in memoized_fib(n)
      7     return n
      8 else:
----> 9     return memoized_fib(n - 1) + memoized_fib(n - 2)

RecursionError: maximum recursion depth exceeded

What's going on?

Dynamic Programming

If we try to evaluate memoized_fib(10_000), we get a strange error:

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in <cell line: 1>()
----> 1 memoized_fib(10_000)

/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in memoized_fib(n)
      7     return n
      8 else:
----> 9     return memoized_fib(n - 1) + memoized_fib(n - 2)

/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in memoized_fib(n)
      7     return n
      8 else:
----> 9     return memoized_fib(n - 1) + memoized_fib(n - 2)

    [... skipping similar frames: memoized_fib at line 9 (1483 times)]

/home/nicholas/programs/constellations/fast-fibonacci/fast-fib.ipynb Cell 15 in memoized_fib(n)
      7     return n
      8 else:
----> 9     return memoized_fib(n - 1) + memoized_fib(n - 2)

RecursionError: maximum recursion depth exceeded

What's going on?