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

At least, that's what I think. Alternatively, we could treat 0 as default values (like in other parts of the code), and users could specify a small time for the values (every iteration will take longer than a nanosecond) and a large number for the heading interval. Thoughts?