
Boost Users : 
From: Shriramana Sharma (samjnaa_at_[hidden])
Date: 20210127 16:17:00
Thanks for replying. Will ask here if I have any further questions.
On Wed, Jan 27, 2021 at 6:38 PM John Maddock via Boostusers
<boostusers_at_[hidden]> wrote:
>
> On 26/01/2021 15:46, Shriramana Sharma via Boostusers wrote:
> > 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
>
> You're quite right  it's superfluous, will fix.
>
> > 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.
>
> When bracket() is called, it updates either fa or fb with the next value
> (fc), and when fc is zero then fa is always set to zero, and the result
> is always a. So checking fb == 0 is unnecessary after a bracket() call.
>
> > 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,
>
> Somewhat different situation  at this point the loop has terminated,
> and we're just tightening up our interval in the case that one of a or b
> is right on the root. This is a nicety not required by the algorithm as
> such, and indeed the fb == 0 branch *may* be superfluous, but I would
> want to think very carefully indeed before changing it ;)
>
> Best, John Maddock.
>
> 
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> Boostusers mailing list
> Boostusers_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boostusers
 Shriramana Sharma à®¶à¯à®°à¯€à®°à®®à®£à®¶à®°à¯à®®à®¾ à¤¶à¥à¤°à¥€à¤°à¤®à¤£à¤¶à¤°à¥à¤®à¤¾ ð‘€°ð‘†ð‘€ð‘€»ð‘€ð‘€«ð‘€¡ð‘€°ð‘€ð‘†ð‘€«ð‘€¸
Boostusers 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