Initial commit of functions from github.com/btracey/optimize

Sorry, left over from debugging when the tests would pass if it returned FunctionGradient but not JustGradient. Removed.