The lagrange method of optimization with applications to portfolio and investment decisions