#include #include #include using namespace ROOT::Math; double myfunc (double x) { return 3*x - 10; } double myfunc_deriv (double x) { return 3 ; } void macro_RootFinder () { Functor1D f ( &myfunc ); RootFinder k ( RootFinder::kGSL_BISECTION ) ; k.SetFunction (f, 1, 10); k.Solve (); cout << "Root found using bisection: " << k.Root() << endl; GradFunctor1D g ( &myfunc , &myfunc_deriv ); k.SetMethod ( RootFinder::kGSL_NEWTON ); k.SetFunction ( g , 4. ); k.Solve (); cout << "Root found using Newton : " << k.Root () << endl; }