Hi everyone. I have problem to deal, in which I have to solve a complicated non-linear equation. I plan to solve it with Bisection method (numerical algorithms). Firstly, I try solving a very simple equation with Bisection method. I read documentation RootFinder. I a little bit undersand. Therefore there is some error. Could you please help me? This is my code.
#include <iostream>
#include <Math/RootFinderAlgorithms.h>
#include <TF1.h>
#include <Math/RootFinder.h>
using namespace ROOT::Math;
using namespace std;
double myfunc(double x)
{
return 3*x - 10;
}
void find_root()
{
RootFinder *k = new RootFinder();
k->SetMethod(RootFinder::kGSL_BISECTION);
k->SetFunction(myfunc, 1, 10);
double c = k->Root();
cout << c << endl;
}