Hi,
just like the subject says, I want to make a plot of integral of exp(-x) from 0 to x, depending on x. The code is rather simple:
TGraph * gr3_negativeExponent {new TGraph()};
for (int t {0}; t<100; t++)
gr3_negativeExponent->AddPoint(t, exp(-t));
TF1 f3_negativeExponent {"f3_negativeExponent", [&](double *x, double *) {return gr3_negativeExponent->Eval(x[0]);}, 0, 100, 0}; // creating a TF1 from TGraph, see https://root.cern.ch/doc/v630/classTF1.html#F5
TGraph * gr3_afterIntegration {new TGraph()};
for (int t {0}; t<100; t++)
gr3_afterIntegration->AddPoint(t, f3_negativeExponent.Integral(0, t));
gr3_afterIntegration->Draw("ACP");
But it fails when I run it:
Error in <GSLError>: Error 18 in qags.c at 547 : cannot reach tolerance because of roundoff error
Warning in <TF1::IntegralOneDim>: Error found in integrating function f3_negativeExponent in [0.000000,11.000000] using AdaptiveSingular. Result = 1.081959 +/- 0.000000 - status = 18
Info in <TF1::IntegralOneDim>: Function Parameters = {
Error in <GSLError>: Error 18 in qags.c at 547 : cannot reach tolerance because of roundoff error
Warning in <TF1::IntegralOneDim>: Error found in integrating function f3_negativeExponent in [0.000000,13.000000] using AdaptiveSingular. Result = 1.081974 +/- 0.000314 - status = 18
Info in <TF1::IntegralOneDim>: Function Parameters = {
Error in <GSLError>: Error 18 in qags.c at 547 : cannot reach tolerance because of roundoff error
Warning in <TF1::IntegralOneDim>: Error found in integrating function f3_negativeExponent in [0.000000,14.000000] using AdaptiveSingular. Result = 1.081976 +/- 0.000000 - status = 18
Info in <TF1::IntegralOneDim>: Function Parameters = {
Error in <GSLError>: Error 18 in qags.c at 547 : cannot reach tolerance because of roundoff error
Warning in <TF1::IntegralOneDim>: Error found in integrating function f3_negativeExponent in [0.000000,15.000000] using AdaptiveSingular. Result = 1.081976 +/- 0.000001 - status = 18
Info in <TF1::IntegralOneDim>: Function Parameters = {
...
(and it goes on and on…)
Is there anything I’m doing wrong?
Thanks!
ROOT Version: tried in 6.30/02 and 6.32/08, the result is the same
Platform: lxplus9 (AlmaLinux 9)
Compiler: g++ (GCC) 13.1.0