# Use graph-\>Integral() encouter problem

**URL:** <https://root-forum.cern.ch/t/use-graph-integral-encouter-problem/38964>\
**Category:** ROOT\
**Tags:** graphics, hist\
**Created:** [April 18, 2020, 12:22pm UTC](https://root-forum.cern.ch/t/use-graph-integral-encouter-problem/38964 "2020-04-18T12:22:50Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![renqipan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/renqipan/32/22738_2.png) [@renqipan](https://root-forum.cern.ch/u/renqipan)\
**Post date:** [April 19, 2020, 3:37am UTC](https://root-forum.cern.ch/t/use-graph-integral-encouter-problem/38964/6 "2020-04-19T03:37:17Z")

</div>

I found an example for calculating the area under the graph.

```cpp
double x[] = { 1,2,3,4,5,6,7,8,9,10};
double y[] = { 1,2,3,4,5,6,7,8,9,10}; 
TGraph g(10,x,y);
TF1 f1("f",[&](double *x, double *){ return g.Eval(x[0]); },1,10,0);
double integral = f1.Integral(1,10);

```

cite: [Integral of TGraph](https://root-forum.cern.ch/t/integral-of-tgraph/4745/12)

---

_[View the full topic](https://root-forum.cern.ch/t/use-graph-integral-encouter-problem/38964)._
