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

Just for convenience we could
if p.Writer == nil {
  p.Writer = os.Stdout
}
?