On Mon, Jun 25, 2018 at 10:30 AM, Mark Alexander Mikofski <mikofski@berkeley.edu> wrote:
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 https://github.com/scipy/scipy/issues/8354
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
I think using something like a `full_output` option as in the fmin_xxx function would be more explicit and more flexible. e.g. the second optional return could be a dict or similar. Josef
Thanks, Mark
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev