Optimal investment policy: An application of Stokes' theorem