Boost logo

Boost Users :

Subject: Re: [Boost-users] Issues with brent_find_minima
From: Anders Wallin (anders.e.e.wallin_at_[hidden])
Date: 2011-08-14 05:58:56


The fourth argument should be an integer specifying the number of bits
of precision you want (not a float-tolerance).
This seems to work:
http://codepad.org/Myd5Th7W
I get:
x=4 f=-2.61457
x=3.42864 f=-3.28835

enjoy,
AW

On Fri, Aug 12, 2011 at 7:23 PM, Frank Astier <fastier_at_[hidden]> wrote:
> I must be missing something: the following program doesn't seem to find the
> right minimum (boost 1.47.0).
> double f(double x) { return x * cos(x); }
> int main(int argc, char** argv)
> {
>   cout << brent_find_minima(f, 3.0, 4.0, 1e-8) << endl;
>   return 0;
> }
> I get: 4 -2.61457
> But I think the minimum is -3.28837 at x = 3.42562.
> Did I miss something in calling brent_find_minima??
> Also, this function should be called "brent_find_minimum" since it finds a
> single minimum, IMHO. The singular is minimum in Latin, minima is the
> plural. Or can the function be called repetitively and each time return a
> different minimum??
> Frank
> fastier_at_[hidden]
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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