Minimizing a numerical function

You don’t have to change nls_obj, just make the anonymous function capture the first output, like here

optimize(x->foo(x, a)[1], ...) 

Note the [1]

1 Like