2 //! \brief Brent_minimise_example.cpp
4 // Copyright Paul A. Bristow 2015.
6 // Use, modification and distribution are subject to the
7 // Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt
9 // or copy at http://www.boost.org/LICENSE_1_0.txt)
11 // Note that this file contains Quickbook mark-up as well as code
12 // and comments, don't change any of the special comment mark-ups!
14 // For some diagnostic information:
15 //#define BOOST_MATH_INSTRUMENT
16 // If quadmath float128 is available:
17 //#define BOOST_HAVE_QUADMATH
19 // Example of finding minimum of a function with Brent's method.
20 //[brent_minimise_include_1
21 #include <boost/math/tools/minima.hpp>
22 //] [/brent_minimise_include_1]
24 #include <boost/math/special_functions/next.hpp>
25 #include <boost/multiprecision/cpp_dec_float.hpp>
26 #include <boost/math/special_functions/pow.hpp>
27 #include <boost/math/constants/constants.hpp>
28 #include <boost/test/floating_point_comparison.hpp> // For is_close_to and is_small
30 //[brent_minimise_mp_include_0
31 #include <boost/multiprecision/cpp_dec_float.hpp> // For decimal boost::multiprecision::cpp_dec_float_50.
32 #include <boost/multiprecision/cpp_bin_float.hpp> // For binary boost::multiprecision::cpp_bin_float_50;
33 //] [/brent_minimise_mp_include_0]
35 //#ifndef _MSC_VER // float128 is not yet supported by Microsoft compiler at 2013.
36 #ifdef BOOST_HAVE_QUADMATH // Define only if GCC or Intel, and have quadmath.lib or .dll library available.
37 # include <boost/multiprecision/float128.hpp>
41 // using std::cout; using std::endl;
43 // using std::setw; using std::setprecision;
45 using std::numeric_limits
;
47 #include <utility> // pair, make_pair
48 #include <type_traits>
51 //typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<50>,
52 // boost::multiprecision::et_off>
53 // cpp_dec_float_50_et_off;
55 // typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<50>,
56 // boost::multiprecision::et_off>
57 // cpp_bin_float_50_et_off;
59 // http://en.wikipedia.org/wiki/Brent%27s_method Brent's method
63 return (x
+ 3) * (x
- 1) * (x
- 1);
66 //[brent_minimise_double_functor
69 double operator()(double const& x
)
71 return (x
+ 3) * (x
- 1) * (x
- 1); // (x + 3)(x - 1)^2
74 //] [/brent_minimise_double_functor]
76 //[brent_minimise_T_functor
80 T
operator()(T
const& x
)
82 return (x
+ 3) * (x
- 1) * (x
- 1); //
85 //] [/brent_minimise_T_functor]
87 //[brent_minimise_close
89 template <class T
= double>
90 bool close(T expect
, T got
, T tolerance
)
92 using boost::math::fpc::is_close_to
;
93 using boost::math::fpc::is_small
;
95 if (is_small
<T
>(expect
, tolerance
))
97 return is_small
<T
>(got
, tolerance
);
101 return is_close_to
<T
>(expect
, got
, tolerance
);
105 //] [/brent_minimise_close]
107 //[brent_minimise_T_show
112 using boost::math::tools::brent_find_minima
;
114 { // Always use try'n'catch blocks with Boost.Math to get any error messages.
116 int bits
= std::numeric_limits
<T
>::digits
/2; // Maximum is digits/2;
117 std::streamsize prec
= static_cast<int>(2 + sqrt(bits
)); // Number of significant decimal digits.
118 std::streamsize precision
= std::cout
.precision(prec
); // Save.
120 std::cout
<< "\n\nFor type " << typeid(T
).name()
121 << ",\n epsilon = " << std::numeric_limits
<T
>::epsilon()
122 // << ", precision of " << bits << " bits"
123 << ",\n the maximum theoretical precision from Brent minimization is " << sqrt(std::numeric_limits
<T
>::epsilon())
124 << "\n Displaying to std::numeric_limits<T>::digits10 " << prec
<< " significant decimal digits."
127 const boost::uintmax_t maxit
= 20;
128 boost::uintmax_t it
= maxit
;
129 // Construct using string, not double, avoids loss of precision.
130 //T bracket_min = static_cast<T>("-4");
131 //T bracket_max = static_cast<T>("1.3333333333333333333333333333333333333333333333333");
133 // Construction from double may cause loss of precision for multiprecision types like cpp_bin_float.
134 // but brackets values are good enough for using Brent minimization.
135 T bracket_min
= static_cast<T
>(-4);
136 T bracket_max
= static_cast<T
>(1.3333333333333333333333333333333333333333333333333);
138 std::pair
<T
, T
> r
= brent_find_minima
<func
, T
>(func(), bracket_min
, bracket_max
, bits
, it
);
140 std::cout
<< " x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
;
143 std::cout
<< ",\n met " << bits
<< " bits precision" << ", after " << it
<< " iterations." << std::endl
;
147 std::cout
<< ",\n did NOT meet " << bits
<< " bits precision" << " after " << it
<< " iterations!" << std::endl
;
149 // Check that result is that expected (compared to theoretical uncertainty).
150 T uncertainty
= sqrt(std::numeric_limits
<T
>::epsilon());
151 //std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is " << close(static_cast<T>(1), r.first, uncertainty) << std::endl;
152 //std::cout << std::boolalpha << "f(x) == (0 compared to uncertainty " << uncertainty << ") is " << close(static_cast<T>(0), r.second, uncertainty) << std::endl;
153 // Problems with this using multiprecision with expression template on?
154 std::cout
.precision(precision
); // Restore.
156 catch (const std::exception
& e
)
157 { // Always useful to include try & catch blocks because default policies
158 // are to throw exceptions on arguments that cause errors like underflow, overflow.
159 // Lacking try & catch blocks, the program will abort without a message below,
160 // which may give some helpful clues as to the cause of the exception.
162 "\n""Message from thrown exception was:\n " << e
.what() << std::endl
;
164 } // void show_minima()
166 //] [/brent_minimise_T_show]
170 std::cout
<< "Brent's minimisation example." << std::endl
;
171 std::cout
<< std::boolalpha
<< std::endl
;
174 // std::cout.precision(std::numeric_limits<T>::digits10);
175 // during debugging is wise because it shows if construction of multiprecision involves conversion from double
176 // by finding random or zero digits after 17.
178 // Specific type double - unlimited iterations.
179 using boost::math::tools::brent_find_minima
;
181 //[brent_minimise_double_1
182 int bits
= std::numeric_limits
<double>::digits
;
184 std::pair
<double, double> r
= brent_find_minima(funcdouble(), -4., 4. / 3, bits
);
186 std::cout
.precision(std::numeric_limits
<double>::digits10
);
187 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
188 // x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018
189 //] [/brent_minimise_double_1]
191 std::cout
<< "x at minimum = " << (r
.first
- 1.) /r
.first
<< std::endl
;
193 double uncertainty
= sqrt(std::numeric_limits
<double>::epsilon());
194 std::cout
<< "Uncertainty sqrt(epsilon) = " << uncertainty
<< std::endl
;
195 // sqrt(epsilon) = 1.49011611938477e-008
196 // (epsilon is always > 0, so no need to take abs value).
198 using boost::math::fpc::is_close_to
;
199 using boost::math::fpc::is_small
;
201 std::cout
<< is_close_to(1., r
.first
, uncertainty
) << std::endl
;
202 std::cout
<< is_small(r
.second
, uncertainty
) << std::endl
;
204 std::cout
<< std::boolalpha
<< "x == 1 (compared to uncertainty " << uncertainty
<< ") is " << close(1., r
.first
, uncertainty
) << std::endl
;
205 std::cout
<< std::boolalpha
<< "f(x) == (0 compared to uncertainty " << uncertainty
<< ") is " << close(0., r
.second
, uncertainty
) << std::endl
;
207 // Specific type double - limit maxit to 20 iterations.
208 std::cout
<< "Precision bits = " << bits
<< std::endl
;
209 //[brent_minimise_double_2
210 const boost::uintmax_t maxit
= 20;
211 boost::uintmax_t it
= maxit
;
212 r
= brent_find_minima(funcdouble(), -4., 4. / 3, bits
, it
);
213 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
214 << " after " << it
<< " iterations. " << std::endl
;
215 //] [/brent_minimise_double_2]
216 // x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018
218 //[brent_minimise_double_3
220 std::streamsize prec
= static_cast<int>(2 + sqrt(bits
)); // Number of significant decimal digits.
221 std::cout
<< "Showing " << bits
<< " bits precision with " << prec
222 << " decimal digits from tolerance " << sqrt(std::numeric_limits
<double>::epsilon())
224 std::streamsize precision
= std::cout
.precision(prec
); // Save.
226 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
227 << " after " << it
<< " iterations. " << std::endl
;
229 //] [/brent_minimise_double_3]
230 // Showing 53 bits precision with 9 decimal digits from tolerance 1.49011611938477e-008
231 // x at minimum = 1, f(1) = 5.04852568e-018
234 //[brent_minimise_double_4
235 bits
/= 2; // Half digits precision (effective maximum).
236 double epsilon_2
= boost::math::pow
<-(std::numeric_limits
<double>::digits
/2 - 1), double>(2);
238 std::cout
<< "Showing " << bits
<< " bits precision with " << prec
239 << " decimal digits from tolerance " << sqrt(epsilon_2
)
241 std::streamsize precision
= std::cout
.precision(prec
); // Save.
243 boost::uintmax_t it
= maxit
;
244 r
= brent_find_minima(funcdouble(), -4., 4. / 3, bits
, it
);
245 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
246 std::cout
<< it
<< " iterations. " << std::endl
;
247 //] [/brent_minimise_double_4]
249 // x at minimum = 1, f(1) = 5.04852568e-018
252 //[brent_minimise_double_5
253 bits
/= 2; // Quarter precision.
254 double epsilon_4
= boost::math::pow
<-(std::numeric_limits
<double>::digits
/ 4 - 1), double>(2);
256 std::cout
<< "Showing " << bits
<< " bits precision with " << prec
257 << " decimal digits from tolerance " << sqrt(epsilon_4
)
259 std::streamsize precision
= std::cout
.precision(prec
); // Save.
261 boost::uintmax_t it
= maxit
;
262 r
= brent_find_minima(funcdouble(), -4., 4. / 3, bits
, it
);
263 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
264 << ", after " << it
<< " iterations. " << std::endl
;
265 //] [/brent_minimise_double_5]
268 // Showing 13 bits precision with 9 decimal digits from tolerance 0.015625
269 // x at minimum = 0.9999776, f(0.9999776) = 2.0069572e-009
273 //[brent_minimise_template_1
274 std::cout
.precision(std::numeric_limits
<long double>::digits10
);
275 long double bracket_min
= -4.;
276 long double bracket_max
= 4. / 3;
277 int bits
= std::numeric_limits
<long double>::digits
;
278 const boost::uintmax_t maxit
= 20;
279 boost::uintmax_t it
= maxit
;
281 std::pair
<long double, long double> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
282 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
283 << ", after " << it
<< " iterations. " << std::endl
;
284 //] [/brent_minimise_template_1]
287 // Show use of built-in type Template versions.
288 // (Will not work if construct bracket min and max from string).
290 //[brent_minimise_template_fd
291 show_minima
<float>();
292 show_minima
<double>();
293 show_minima
<long double>();
294 //] [/brent_minimise_template_fd]
296 using boost::multiprecision::cpp_bin_float_50
; // binary.
298 //[brent_minimise_mp_include_1
299 #ifdef BOOST_HAVE_QUADMATH // Define only if GCC or Intel and have quadmath.lib or .dll library available.
300 using boost::multiprecision::float128
;
302 //] [/brent_minimise_mp_include_1]
304 //[brent_minimise_template_quad
306 #ifdef BOOST_HAVE_QUADMATH // Define only if GCC or Intel and have quadmath.lib or .dll library available.
307 show_minima
<float128
>(); // Needs quadmath_snprintf, sqrtQ, fabsq that are in in quadmath library.
309 //] [/brent_minimise_template_quad
311 // User-defined floating-point template.
313 //[brent_minimise_mp_typedefs
314 using boost::multiprecision::cpp_bin_float_50
; // binary.
316 typedef boost::multiprecision::number
<boost::multiprecision::cpp_bin_float
<50>,
317 boost::multiprecision::et_on
>
318 cpp_bin_float_50_et_on
; // et_on is default so is same as cpp_bin_float_50.
320 typedef boost::multiprecision::number
<boost::multiprecision::cpp_bin_float
<50>,
321 boost::multiprecision::et_off
>
322 cpp_bin_float_50_et_off
;
324 using boost::multiprecision::cpp_dec_float_50
; // decimal.
326 typedef boost::multiprecision::number
<boost::multiprecision::cpp_dec_float
<50>,
327 boost::multiprecision::et_on
> // et_on is default so is same as cpp_dec_float_50.
328 cpp_dec_float_50_et_on
;
330 typedef boost::multiprecision::number
<boost::multiprecision::cpp_dec_float
<50>,
331 boost::multiprecision::et_off
>
332 cpp_dec_float_50_et_off
;
333 //] [/brent_minimise_mp_typedefs]
335 { // binary ET on by default.
336 //[brent_minimise_mp_1
337 std::cout
.precision(std::numeric_limits
<cpp_bin_float_50
>::digits10
);
339 cpp_bin_float_50
fpv("-1.2345");
340 cpp_bin_float_50 absv
;
342 absv
= fpv
< static_cast<cpp_bin_float_50
>(0) ? -fpv
: fpv
;
343 std::cout
<< fpv
<< ' ' << absv
<< std::endl
;
346 int bits
= std::numeric_limits
<cpp_bin_float_50
>::digits
/ 2 - 2;
348 cpp_bin_float_50 bracket_min
= static_cast<cpp_bin_float_50
>("-4");
349 cpp_bin_float_50 bracket_max
= static_cast<cpp_bin_float_50
>("1.3333333333333333333333333333333333333333333333333");
351 std::cout
<< bracket_min
<< " " << bracket_max
<< std::endl
;
352 const boost::uintmax_t maxit
= 20;
353 boost::uintmax_t it
= maxit
;
354 std::pair
<cpp_bin_float_50
, cpp_bin_float_50
> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
356 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
357 // x at minimum = 1, f(1) = 5.04853e-018
358 << ", after " << it
<< " iterations. " << std::endl
;
360 close(static_cast<cpp_bin_float_50
>(1), r
.first
, sqrt(std::numeric_limits
<cpp_bin_float_50
>::epsilon()));
362 //] [/brent_minimise_mp_1]
365 //[brent_minimise_mp_output_1
366 For type class boost::multiprecision::number<class boost::multiprecision::backends::cpp_bin_float<50, 10, void, int, 0, 0>, 1>,
367 epsilon = 5.3455294202e-51,
368 the maximum theoretical precision from Brent minimization is 7.311312755e-26
369 Displaying to std::numeric_limits<T>::digits10 11 significant decimal digits.
370 x at minimum = 1, f(1) = 5.6273022713e-58,
371 met 84 bits precision, after 14 iterations.
372 //] [/brent_minimise_mp_output_1]
374 //[brent_minimise_mp_2
375 show_minima
<cpp_bin_float_50_et_on
>(); //
376 //] [/brent_minimise_mp_2]
379 //[brent_minimise_mp_output_2
380 For type class boost::multiprecision::number<class boost::multiprecision::backends::cpp_bin_float<50, 10, void, int, 0, 0>, 1>,
382 //] [/brent_minimise_mp_output_1]
386 { // binary ET on explicit
387 std::cout
.precision(std::numeric_limits
<cpp_bin_float_50_et_on
>::digits10
);
389 int bits
= std::numeric_limits
<cpp_bin_float_50_et_on
>::digits
/ 2 - 2;
391 cpp_bin_float_50_et_on bracket_min
= static_cast<cpp_bin_float_50_et_on
>("-4");
392 cpp_bin_float_50_et_on bracket_max
= static_cast<cpp_bin_float_50_et_on
>("1.3333333333333333333333333333333333333333333333333");
394 std::cout
<< bracket_min
<< " " << bracket_max
<< std::endl
;
395 const boost::uintmax_t maxit
= 20;
396 boost::uintmax_t it
= maxit
;
397 std::pair
<cpp_bin_float_50_et_on
, cpp_bin_float_50_et_on
> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
399 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
400 // x at minimum = 1, f(1) = 5.04853e-018
401 std::cout
<< it
<< " iterations. " << std::endl
;
403 show_minima
<cpp_bin_float_50_et_on
>(); //
409 std::cout
.precision(std::numeric_limits
<cpp_bin_float_50_et_off
>::digits10
);
411 int bits
= std::numeric_limits
<cpp_bin_float_50_et_off
>::digits
/ 2 - 2;
412 cpp_bin_float_50_et_off bracket_min
= static_cast<cpp_bin_float_50_et_off
>("-4");
413 cpp_bin_float_50_et_off bracket_max
= static_cast<cpp_bin_float_50_et_off
>("1.3333333333333333333333333333333333333333333333333");
415 std::cout
<< bracket_min
<< " " << bracket_max
<< std::endl
;
416 const boost::uintmax_t maxit
= 20;
417 boost::uintmax_t it
= maxit
;
418 std::pair
<cpp_bin_float_50_et_off
, cpp_bin_float_50_et_off
> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
420 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
421 // x at minimum = 1, f(1) = 5.04853e-018
422 std::cout
<< it
<< " iterations. " << std::endl
;
424 show_minima
<cpp_bin_float_50_et_off
>(); //
427 { // decimal ET on by default
428 std::cout
.precision(std::numeric_limits
<cpp_dec_float_50
>::digits10
);
430 int bits
= std::numeric_limits
<cpp_dec_float_50
>::digits
/ 2 - 2;
432 cpp_dec_float_50 bracket_min
= static_cast<cpp_dec_float_50
>("-4");
433 cpp_dec_float_50 bracket_max
= static_cast<cpp_dec_float_50
>("1.3333333333333333333333333333333333333333333333333");
435 std::cout
<< bracket_min
<< " " << bracket_max
<< std::endl
;
436 const boost::uintmax_t maxit
= 20;
437 boost::uintmax_t it
= maxit
;
438 std::pair
<cpp_dec_float_50
, cpp_dec_float_50
> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
440 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
441 // x at minimum = 1, f(1) = 5.04853e-018
442 std::cout
<< it
<< " iterations. " << std::endl
;
444 show_minima
<cpp_dec_float_50
>();
448 std::cout
.precision(std::numeric_limits
<cpp_dec_float_50_et_on
>::digits10
);
450 int bits
= std::numeric_limits
<cpp_dec_float_50_et_on
>::digits
/ 2 - 2;
452 cpp_dec_float_50_et_on bracket_min
= static_cast<cpp_dec_float_50_et_on
>("-4");
453 cpp_dec_float_50_et_on bracket_max
= static_cast<cpp_dec_float_50_et_on
>("1.3333333333333333333333333333333333333333333333333");
454 std::cout
<< bracket_min
<< " " << bracket_max
<< std::endl
;
455 const boost::uintmax_t maxit
= 20;
456 boost::uintmax_t it
= maxit
;
457 std::pair
<cpp_dec_float_50_et_on
, cpp_dec_float_50_et_on
> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
459 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
460 // x at minimum = 1, f(1) = 5.04853e-018
461 std::cout
<< it
<< " iterations. " << std::endl
;
463 show_minima
<cpp_dec_float_50_et_on
>();
468 std::cout
.precision(std::numeric_limits
<cpp_dec_float_50_et_off
>::digits10
);
470 int bits
= std::numeric_limits
<cpp_dec_float_50_et_off
>::digits
/ 2 - 2;
472 cpp_dec_float_50_et_off bracket_min
= static_cast<cpp_dec_float_50_et_off
>("-4");
473 cpp_dec_float_50_et_off bracket_max
= static_cast<cpp_dec_float_50_et_off
>("1.3333333333333333333333333333333333333333333333333");
475 std::cout
<< bracket_min
<< " " << bracket_max
<< std::endl
;
476 const boost::uintmax_t maxit
= 20;
477 boost::uintmax_t it
= maxit
;
478 std::pair
<cpp_dec_float_50_et_off
, cpp_dec_float_50_et_off
> r
= brent_find_minima(func(), bracket_min
, bracket_max
, bits
, it
);
480 std::cout
<< "x at minimum = " << r
.first
<< ", f(" << r
.first
<< ") = " << r
.second
<< std::endl
;
481 // x at minimum = 1, f(1) = 5.04853e-018
482 std::cout
<< it
<< " iterations. " << std::endl
;
484 show_minima
<cpp_dec_float_50_et_off
>();
495 // GCC 4.9.1 with quadmath
497 Brent's minimisation example.
498 x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018
499 x at minimum = 1.12344622367552e-009
500 Uncertainty sqrt(epsilon) = 1.49011611938477e-008
501 x == 1 (compared to uncertainty 1.49011611938477e-008) is true
502 f(x) == (0 compared to uncertainty 1.49011611938477e-008) is true
504 x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018 after 10 iterations.
505 Showing 53 bits precision with 9 decimal digits from tolerance 1.49011611938477e-008
506 x at minimum = 1, f(1) = 5.04852568e-018 after 10 iterations.
507 Showing 26 bits precision with 9 decimal digits from tolerance 0.000172633492
508 x at minimum = 1, f(1) = 5.04852568e-018
510 Showing 13 bits precision with 9 decimal digits from tolerance 0.015625
511 x at minimum = 0.9999776, f(0.9999776) = 2.0069572e-009, after 7 iterations.
512 x at minimum = 1.00000000000137302, f(1.00000000000137302) = 7.5407901369731193e-024, after 10 iterations.
516 epsilon = 1.1921e-007,
517 the maximum theoretical precision from Brent minimization is 0.00034527
518 Displaying to std::numeric_limits<T>::digits10 5 significant decimal digits.
519 x at minimum = 1.0002, f(1.0002) = 1.9017e-007,
520 met 12 bits precision, after 7 iterations.
521 x == 1 (compared to uncertainty 0.00034527) is true
522 f(x) == (0 compared to uncertainty 0.00034527) is true
526 epsilon = 2.220446e-016,
527 the maximum theoretical precision from Brent minimization is 1.490116e-008
528 Displaying to std::numeric_limits<T>::digits10 7 significant decimal digits.
529 x at minimum = 1, f(1) = 5.048526e-018,
530 met 26 bits precision, after 10 iterations.
531 x == 1 (compared to uncertainty 1.490116e-008) is true
532 f(x) == (0 compared to uncertainty 1.490116e-008) is true
536 epsilon = 1.084202e-019,
537 the maximum theoretical precision from Brent minimization is 3.292723e-010
538 Displaying to std::numeric_limits<T>::digits10 7 significant decimal digits.
539 x at minimum = 1, f(1) = 7.54079e-024,
540 met 32 bits precision, after 10 iterations.
541 x == 1 (compared to uncertainty 3.292723e-010) is true
542 f(x) == (0 compared to uncertainty 3.292723e-010) is true
545 For type N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE,
546 epsilon = 1.92592994e-34,
547 the maximum theoretical precision from Brent minimization is 1.38777878e-17
548 Displaying to std::numeric_limits<T>::digits10 9 significant decimal digits.
549 x at minimum = 1, f(1) = 1.48695468e-43,
550 met 56 bits precision, after 12 iterations.
551 x == 1 (compared to uncertainty 1.38777878e-17) is true
552 f(x) == (0 compared to uncertainty 1.38777878e-17) is true
553 -4 1.3333333333333333333333333333333333333333333333333
554 x at minimum = 0.99999999999999999999999999998813903221565569205253, f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations.
557 For type N5boost14multiprecision6numberINS0_8backends13cpp_bin_floatILj50ELNS2_15digit_base_typeE10EviLi0ELi0EEELNS0_26expression_template_optionE1EEE,
558 epsilon = 5.3455294202e-51,
559 the maximum theoretical precision from Brent minimization is 7.311312755e-26
560 Displaying to std::numeric_limits<T>::digits10 11 significant decimal digits.
561 x at minimum = 1, f(1) = 5.6273022713e-58,
562 met 84 bits precision, after 14 iterations.
563 x == 1 (compared to uncertainty 7.311312755e-26) is true
564 f(x) == (0 compared to uncertainty 7.311312755e-26) is true
565 -4 1.3333333333333333333333333333333333333333333333333
566 x at minimum = 0.99999999999999999999999999998813903221565569205253, f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58
570 For type N5boost14multiprecision6numberINS0_8backends13cpp_bin_floatILj50ELNS2_15digit_base_typeE10EviLi0ELi0EEELNS0_26expression_template_optionE1EEE,
571 epsilon = 5.3455294202e-51,
572 the maximum theoretical precision from Brent minimization is 7.311312755e-26
573 Displaying to std::numeric_limits<T>::digits10 11 significant decimal digits.
574 x at minimum = 1, f(1) = 5.6273022713e-58,
575 met 84 bits precision, after 14 iterations.
576 x == 1 (compared to uncertainty 7.311312755e-26) is true
577 f(x) == (0 compared to uncertainty 7.311312755e-26) is true
579 RUN SUCCESSFUL (total time: 90ms)