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

Done. For future reference, is there a rule of thumb that goes with this? I usually put the more complicated entry first.