Stav dette: Dynamic programming and the calculus of variations