Hi,
Would anyone disagree or would anyone be interested in a proposal to allow the derivative to be returned from the user supplied function as an optional second argument in gradient search method like Newton? EG
>>> lambda x,a: (x**3-a, 3*x*"2)
>>> newton(f, x0, fprime='f2', args=(a,))
Some simple tests show that this may have a 2X speed in cases where the derivative expression requires the value of the original function call.
See this issue in which I proposed this idea and wore a sample test script
I proposed a way to keep the existing API and add this new feature.
* If `fprime` is a callable, then same as before
* If it's a string like "f2" the get fprime from second output
Thanks,
Mark