Boost logo

Boost Users :

Subject: Re: [Boost-users] [Math] advice using brent_find_minima()
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2014-12-09 10:07:42


> -----Original Message-----
> From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
John
> Maddock
> Sent: 09 December 2014 12:58
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [Math] advice using brent_find_minima()
>
> > I'd like to find the root of a function f (find x such that f(x) = 0).
> >
> > Should I pass abs( f ) to brent_find_minima()?
>
> No: that's a truly lousy method for finding the root.
>
> If you have one or more derivatives of f then use newton_raphson_iterate or
> halley_iterate from
> http://www.boost.org/doc/libs/1_57_0/libs/math/doc/html/math_toolkit/internals
> 1/roots.html
>
> Otherwise use toms748_solve or bracket_and_solve_root from
> http://www.boost.org/doc/libs/1_57_0/libs/math/doc/html/math_toolkit/internals
> 1/roots2.html.
> Note that the latter of these two calls the former, which happens to be
> asymptotically optimal if you have no derivative information.
>
> And no, we don't have examples for these as they're "details" that aren't
officially
> part of the library yet. However, we really should do something about that as
the
> code has actually been stable for millennia now ;-)

There is an example

http://www.boost.org/doc/libs/1_57_0/libs/math/example/root_finding_example.cpp

that you might find helpful.

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830

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