A study showing that the functional equation technique of dynamic programming yields formal derivations of such classical necessary conditions of the calculus of variations as the Euler-Lagrange equations, the Weierstrass and Legendre conditions, nat...