Text this: The Rayleigh quotient and dynamic programming