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

Yes, that's what I meant, treat 0 as default values like we do elsewhere. But if it is not clear what we should do about this (if anything at all), I would leave it for later, this is not a high priority.