Numerical integration with ROOT. (Function defined in points)

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.

https://root.cern/doc/master/classTGraph.html#a635997a6d81e4e89529aaf1819cf7533

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; }

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.