Boost logo

Boost Users :

From: Shriramana Sharma (samjnaa_at_[hidden])
Date: 2021-01-26 15:46:15


Namaste.

This is wrt the TOMS748 math root finding implementation:

Given that `if(fa == 0)` is handled at:

https://github.com/boostorg/math/blob/develop/include/boost/math/tools/toms748_solve.hpp#L325

… and the function returns in case of the above condition, it is not
clear to me what the need is for the `if (fa != 0)` at:

https://github.com/boostorg/math/blob/develop/include/boost/math/tools/toms748_solve.hpp#L342

Note that I do not find the condition being applied at the SciPy
implementation of this algorithm at:

https://github.com/scipy/scipy/blob/v1.6.0/scipy/optimize/zeros.py#L1220

Now I also note similar checks at:

https://github.com/boostorg/math/blob/develop/include/boost/math/tools/toms748_solve.hpp#L352
https://github.com/boostorg/math/blob/develop/include/boost/math/tools/toms748_solve.hpp#L366

… but regarding those lines, while I can understand the need for
checking there after more bracketing work is done, it is not clear to
me why `(fa == 0)` is alone checked for, and not `(fb == 0)` as well.
I would have thought the algorithm is not biased towards a or b.

Indeed, in the last steps from:

https://github.com/boostorg/math/blob/develop/include/boost/math/tools/toms748_solve.hpp#L465,

… both the conditions are checked for, which is what I would expect
even in the intervening steps.

Now the lines seem to have originated in the very first commit
implementing this algorithm:
https://github.com/boostorg/math/commit/79a8199f9c26ba353fb52ec4543f75ffc2a8c95b

… but I do not see a way to contact the author jzmaddock other than
posting to this list, so I hope someone/they see here and reply.

Thanks!

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा 𑀰𑁆𑀭𑀻𑀭𑀫𑀡𑀰𑀭𑁆𑀫𑀸

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net