Minuit fails giving a good fit whith Pade aproximants

Hi, I am Pablo

I was using Root Minuit to fit some data taken from a known function
~ (1/Q²)*Log(1-(Q²))
So I generated the data with the Q² values and the function value

I plotted the graph and then used “mygraph->Fit(“fit function”);” to perform the fit
I started with lowest order Padé approximants and used the values of first approximations to be the initial values of further approximations. It worked perfectly for the zeroth, first and second orders, however, at third order it gives a bad fit with bigger chi² value than the previous ones. If I keep following to the fourth, I get the same problem …

I have tried to change to different algorithms and it gets even worse, also I changed the strategy to get a good fit rather than a fast one. Asides, I tried a scan on the parameter initial values and didn’t get a good result … any idea?

Thanks in advance

I attach the code “myPadeRoot.C” and the data logdata.C which shoul dbe renamed to “logdata.dat”
This is the code (apart from the headers)

[code]#include
#include
#include

#include “TROOT.h”
#include “TChain.h”
#include “TString.h”
#include “THStack.h”
#include “TF1.h”
#include “TCanvas.h”
#include “TPad.h”
#include “TH1.h”
#include “TH2.h”
#include “TLegend.h”
#include “TPaveText.h”
#include “TVirtualFitter.h”
#include “TMath.h”
#include “TClonesArray.h”
#include “TLatex.h”
#include “TStyle.h”
#include “TNamed.h”

void myPadeRoot()
{

gROOT->Reset();

//Variables to use
Double_t chi2 = 100;
Double_t p0 = 0;
Double_t p1 = 0;
Double_t p2 = 0;
Double_t p3 = 0;
Double_t p4 = 0;
Double_t p5 = 0;

//Take data form ascii file and plot it
TGraph *mygraph = new TGraph(“logdata.dat”);
mygraph->Draw(“ALP”);

//Set some Minimizer options
ROOT::Math::MinimizerOptions::SetDefaultMinimizer(“Minuit”,“Migrad”);
ROOT::Math::MinimizerOptions::SetDefaultStrategy(2);
ROOT::Math::MinimizerOptions::SetDefaultErrorDef(1);

//Start the fit to the Padé aproximants, order by order

//Zeroth order [1,0]
TF1 *P10 = new TF1(“P10”,"[0]/(1-(([1]/[0])*x) )"); // Define the fit function
P10->SetParameters(0,0); // Set initial parameters value
mygraph->Fit(“P10”,“EM+”);
p0 = P10->GetParameter(0); p1 = P10->GetParameter(1); chi2 = P10->GetChisquare();

//First order [1,1]
TF1 *P11 = new TF1(“P11”,"[0] + ([1]*x)/(1-(([2]/[1])*x) )");
P11->SetParameters(p0,p1,0);
mygraph->Fit(“P11”,“EM+”);
p0 = P11->GetParameter(0); p1 = P11->GetParameter(1); p2 = P11->GetParameter(2); chi2 = P11->GetChisquare();

//Second order [1,2]
TF1 *P12 = new TF1(“P12”,"[0] + [1]*x + ([2]xx)/(1-(([3]/[2])*x) )");
P12->SetParameters(p0,p1,p2,0);
mygraph->Fit(“P12”,“EM+”);
p0 = P12->GetParameter(0); p1 = P12->GetParameter(1); p2 = P12->GetParameter(2); p3 = P12->GetParameter(3); chi2 = P12->GetChisquare();

//Third order [1,3]
TF1 *P13 = new TF1(“P13”,"[0] + [1]x + [2]xx + ([3]xxx)/(1-(([4]/[3])*x) )");
P13->SetParameters(p0,p1,p2,p3,0);
mygraph->Fit(“P13”,“EM+”);

//Fourth order [1,4]
TF1 P14 = new TF1(“P14”,"[0] + [1]x + [2]xx + [3]xxx + ([4]xxx*x)/(1-(([5]/[4])*x) )");
P14->SetParameters(p0,p1,p2,p3,0,0);
mygraph->Fit(“P14”,“M+”);

}

[/code]
logdata.C (946 Bytes)
myPadeRoot.C (2.55 KB)

I forgot to say that, sometimes (it depends on the initial value for the last parameter [4]), I get in the fit the following message “Invalid FitResult (status = 4 )”