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

I at least made the change to FunctionOnly and GradientOnly. Waiting for more input.