# Integral of TSpline

Dear all:

``````     How can I integrate the fitting result of TSpline3 ? There is no something

like TSpline3::Integral ?

By the way, for interpolating a discrete data,the TSpine function is not bad.

But the documentation of this function is poor. For example,what are the choices

of the "opt" argument ? I can't find it.

Thanks,
Jack``````

Of which interpolation function are you talking about in TSpline? Eval? but is does not have any option.
Although I agree it would be nice to have a TSpline::Integral, you can easily build a TF1 with a C function and in this C function call TSpline::Eval

Rene

Dear Rene:

``````   Maybe I don't fully understand "TSpline" or I misunderstand what you mean.

I tried but still fail. Here is my code:
``````

void interpolation2(void)
{
int x={1,2,3,4,5,6,7,8,9};
int y={1,2,3,4,5,4,3,2,1};

``````  TGraph *mygra=new TGraph(10,x,y);
TSpline3 *s=new TSpline3("s",mygra);

TF1 *formula=new TF1("formula","s->Eval(x)",1,9);
``````

// TF1 *formula=new TF1(“formula”,“mygra->Eval(x)”,1,9); (<-- still fail)

``````  mygra->Draw("AC*");
formula->Draw("same");

}

The error message is :

Error in <TFormula::Compile>:  Bad numerical expression : "s.Eval(x)"
Error in <TF1::TF1>: function: formula/s->Eval(x) has 0 parameters instead of 1
``````

=========================================================

I need to calculate a integration whose integrand formed by timing this interpolation

result with another theoretical function(blackbody formula actually). So I need to

transform this discrete data points to a normal and usable function. Or any other

way I can do?

Thank you very much,
Jack.