# include # include # include # include "brent.hpp" double f ( double x ); using namespace std; int main ( ) // // LOCAL_MIN_TEST tests the BRENT function "LOCAL_MIN". // { double a = -5.0, b = 1.0, fmin, t = 0.000001, xmin; fmin = local_min ( a, b, t, f, xmin ); cout << "\n"; cout << "LOCAL_MIN returns FMIN = " << fmin << " at x = " << xmin << "\n"; return 0; } double f ( double x ) { double value; value = ( x + sin ( x ) ) * exp ( - x * x ); return value; }