|
Boost Users : |
From: pbristow_at_[hidden]
Date: 2019-11-07 14:11:33
> -----Original Message-----
> From: Boost-users <boost-users-bounces_at_[hidden]> On Behalf Of Saurabh T
> via Boost-users
> Sent: 7 November 2019 12:51
> To: boost-users_at_[hidden]
> Cc: Saurabh T <saurabh_at_[hidden]>
> Subject: [Boost-users] bracket_and_solve_root "rising" option
>
> Hi,
>
> I would like a way to bracket the root without having to compute or specify the
> "rising" flag to "bracket_and_solve_root". Is there a way to edit the bracketing
> implementation so the user need not specify that option? Thanks,
You could just assume is_rising ==true and see if it converges by testing if iterations >= max_iterations
Setting max_iterations to a sensible value (<50) will avoid a long wait ð
If it doesn't converge, try is_rising = false. Crude and slow?
Or you could compute the bounds yourself and use TOMS748
boost/libs/math/doc/html/math_toolkit/roots_noderiv/TOMS748.html
but that means more work.
Or you could use Brent's algorithm \math\example\brent_minimise_example.cpp, but you still need to provide bracket values, and choosing -infinity and +infinity will not be fast.
(Again limiting the number of iterations is wise if you fear a long wait).
Fundamentally it is important to provide the algorithm with as much info as possible as a guess, bracket limits, and is rising or falling in order that it works efficiently, or indeed at all.
I suspect you do know more really?
HTH
Paul
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