# TF1 Integral seems to be nonlinear

Hello everyone,
I have a Problem with the TF1:Integral function. Using Root6 the sum of two integrated functions is not equal to the integral of the sum of functions. If I use Root5, the integral works correctly. Please see the working example below. Am I making a mistake?

``````void minimalexample()
{
double par = 1.0;
double LeftBorder = 0.0;
double RightBorder = 1.0;

TF1* test1 = new TF1("test","gaus(0)");
test1->FixParameter(0,par);
test1->FixParameter(1,par);
test1->FixParameter(2,par);
double test1Integral = test1->Integral(LeftBorder, RightBorder);

TF1* test2 = new TF1("test","pol1(0)");
test2->FixParameter(0,par);
test2->FixParameter(1,par);
double test2Integral = test2->Integral(LeftBorder, RightBorder);

TF1* test3 = new TF1("test","gaus(0)+pol1(3)");
test3->FixParameter(0,par);
test3->FixParameter(1,par);
test3->FixParameter(2,par);
test3->FixParameter(3,par);
test3->FixParameter(4,par);
double test3Integral = test3->Integral(LeftBorder, RightBorder);

cout << "Integral Over Sum = " << test3Integral << endl;
cout << "Sum Over Integrals "  << test1Integral + test2Integral << endl;
}``````

Root 6.04/00 gives the following result:

``````Integral Over Sum = 1.5
Sum Over Integrals 2.35562``````

Root 5.34/03 gives the following result:

``````Integral Over Sum = 2.35562
Sum Over Integrals 2.35562``````

Any help is appreciated. Thank you in advance.
Florian

Hi,

This is due to a bug in TFormula which tags the function as a polynomial. This causes then the function to be analytically integrated thinking that is just a polynomial.
I will fix this now. As a workaround do not use pol, but define the function as
TF1 f(“f”,“gaus(0)+[3]+[4]*x”)

Best Regards

Lorenzo

Wow, that was quick. Thank you for your response, it works indeed. I can continue my work with this.

Best regards,
Florian