# Numerical integration with ROOT. (Function defined in points)

**URL:** <https://root-forum.cern.ch/t/numerical-integration-with-root-function-defined-in-points/24651>\
**Category:** ROOT\
**Created:** [May 5, 2017, 5:29am UTC](https://root-forum.cern.ch/t/numerical-integration-with-root-function-defined-in-points/24651 "2017-05-05T05:29:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 5, 2017, 7:51am UTC](https://root-forum.cern.ch/t/numerical-integration-with-root-function-defined-in-points/24651/3 "2017-05-05T07:51:02Z")

</div>

Be aware that the [TGraph::Integral](https://root.cern/doc/master/classTGraph.html#a635997a6d81e4e89529aaf1819cf7533) 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;
}`

---

_[View the full topic](https://root-forum.cern.ch/t/numerical-integration-with-root-function-defined-in-points/24651)._
