Fitting of the integral of a function

Dear All,

I have not got any reply from anyone of you. Please reply if the problem can be solved !!

I am trying to fit a function f(y) = Integral 1/cosh(y-a)da, with a data set, where the limit is from ‘-a’ to ‘a’,
N.B ‘a’ is a free parameter need to be calculated from the fit.

Now, it is easy to fit the function without the ‘integral’ which is -

[code]Double_t Th(Double_t *y, Double_t *a){
Double_t f2 = 1/cosh(*y-a[0]);
return f2;

void fitting(){

TF1* func=new TF1(“func”,Th,-1,6,1);
func->SetParameter(0, 0.2);

TGraphErrors *gr1 = new TGraphErrors (“data/x11.txt”, “%lg %lg”);

TCanvas *c1 = new TCanvas();
gr1->Fit(“func”, “q”);

But, I have no idea how fit with the integral of the function.

Please help me in this regards.


The best (and fastest) way is to analytically calculate the integral and fit that function.
Here is the integral of your function: … 28y-a%29da