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

It should be whatever the final package name is. It seems like optimize is preferred over opt.