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

The Error consts are always accompanied with an actual error return, but I see your point. I'll make the change as you suggest.