What if I know my function I want to integrate only in some points. Does ROOT provide any integration method for this case?
Thanks in advance.
What if I know my function I want to integrate only in some points. Does ROOT provide any integration method for this case?
Thanks in advance.
Be aware that the TGraph::Integral name is extremely misleading.
It calculates the “pseudo-integral” of a closed polygon, NOT the “integral” of the function.
Try this: {
TGraph *g = new TGraph();
g->SetPoint(0, 1.0, 1.0);
g->SetPoint(1, 2.0, 0.0);
g->SetPoint(2, 3.0, 2.0);
g->SetPoint(3, 4.0, 1.0);
g->Draw("AL*");
std::cout << "ROOT's pseudo-integral = " << g->Integral(0, 3) << std::endl;
}
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.