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

This is confusing. Why is ErrInf about NaN?