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

If you'd like to give me the location in the second edition I can update the reference.