[SciPy-Dev] More robust scalar root finding
Juan Luis Cano
juanlu001 at gmail.com
Thu Aug 27 05:56:59 EDT 2020
Hi all,
A month ago I was trying to migrate some MATLAB code to Python and found a
couple of annoyances in the scalar root finding functions of SciPy. I
opened these issues:
"Make root_scalar work when only x0 is given, similar to newton"
https://github.com/scipy/scipy/issues/12620
"newton chokes when iteration steps outside function domain"
https://github.com/scipy/scipy/issues/12625
and a pull request to address #12625:
"Make scalar, iterative root finding methods robust against steps outside
domain" https://github.com/scipy/scipy/pull/12626
It seems that the conversation has stalled, so I wanted to bring them to
the mailing list.
As I said in #12625, common wisdom dictates that if one chooses a starting
guess closer to the real solution, convergence is achieved. However,
leaving this well known numerical fact aside for a moment, I wonder if some
work could be done on the *usability* side of things to
(a) make root_scalar a drop-in replacement to newton (#12620)
(b) have some opt-out way to increase the robustness of the solution in a
way that "just works", which is that MATLAB and Octave achieve (#12625)
A personal side note: The original authors of the code I'm migrating tried
Python half a decade ago but noticed that "SciPy was not converging, while
MATLAB had no problems", so they ended up using the latter. While we all
scoffed when the infamous "top reasons to choose MATLAB" comparison was
published [1][2][3][4], I do think there's still a lot to understand from a
UX point of view of why people choose one or another. After 7 years of
teaching Python to engineers, they either become data scientists or they go
back to MATLAB, and as a result I have decided to get my hands dirty and
find out the reasons, to the best of my possibilities.
Best,
Juan Luis
[1]
https://web.archive.org/web/20190806100605/https://www.mathworks.com/products/matlab/matlab-vs-python.html
[2] https://twitter.com/moorepants/status/1158248132355874817
[3] https://twitter.com/randal_olson/status/1158402855818018816
[4] https://twitter.com/neuromusic/status/1158556716096618497
[5] https://twitter.com/vboykis/status/1158559458173313024
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20200827/2537c691/attachment.html>
More information about the SciPy-Dev
mailing list