# Strange issue while fitting

**URL:** <https://root-forum.cern.ch/t/strange-issue-while-fitting/58137>\
**Category:** Newbie\
**Tags:** root\
**Created:** [February 11, 2024, 9:27pm UTC](https://root-forum.cern.ch/t/strange-issue-while-fitting/58137 "2024-02-11T21:27:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [February 11, 2024, 9:27pm UTC](https://root-forum.cern.ch/t/strange-issue-while-fitting/58137/1 "2024-02-11T21:27:24Z")

</div>

Hi I am trying to fit

```auto
TF1 *func = new TF1("fitf","[3] + [2]*x + [0]/TMath::Sqrt(x + [1])", 50, 1400);
func->SetParNames("a","b","c", "d");

```

to a set of four (x,y) points  
The fit results shows

```auto
***************************************
Minimizer is Minuit / Migrad
Chi2 = 152.672
NDf = 0
Edm = 1.27128e-07
NCalls = 272
a = -667829 +/- 3978.14     
b = 2501.96 +/- 27.8618     
c = -1.19202 +/- 0.0117273   
d = 13044.7 +/- 11.1118     

```

Showing the degrees of freedom to be 0 can someone please help me what I am messing here?  
Further, if I change the initial parameters very slightly the fit seems to get upset as evident from

```auto
Warning in <Fit>: Abnormal termination of minimization.

****************************************
         Invalid FitResult (status = 4 )
****************************************
Minimizer is Minuit / Migrad
Chi2 = 154.198
NDf = 0
Edm = 0.61487
NCalls = 1490
p0 = -636027 +/- 14397.5     
p1 = 2435.92 +/- 32.2021     
p2 = -1.16013 +/- 0.0250483   
p3 = 12578.4 +/- 231.218     

```

Thanks a lot

Edit 1: I guess ndf =0 since the number of data points are equal as fit parameters but is there any way around to fit these points ?

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [February 11, 2024, 9:48pm UTC](https://root-forum.cern.ch/t/strange-issue-while-fitting/58137/2 "2024-02-11T21:48:48Z")

</div>

Hi,

It does not look like a problem of ROOT. Without a reproducer, it’s hard to say what the message is hinting to.

Best,  
Danilo

---

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [February 11, 2024, 10:00pm UTC](https://root-forum.cern.ch/t/strange-issue-while-fitting/58137/3 "2024-02-11T22:00:21Z")

</div>

Hi,  
Thanks for your reply  
Here is the minimalistic macro to reproduce the issue if it helps.  
[fit1.C](https://root-forum.cern.ch/uploads/short-url/nZGHREiUWVVWgKQuVofAqra7rve.C) (664 Bytes)

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [February 11, 2024, 10:13pm UTC](https://root-forum.cern.ch/t/strange-issue-while-fitting/58137/4 "2024-02-11T22:13:02Z")

</div>

Hi,

Thanks. Indeed this post seems to have addressed a very similar inquiry: [Is fit validity or minimizer status more important? - #2 by moneta](https://root-forum.cern.ch/t/is-fit-validity-or-minimizer-status-more-important/30637/2)

Best,  
D

---

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [February 11, 2024, 10:32pm UTC](https://root-forum.cern.ch/t/strange-issue-while-fitting/58137/5 "2024-02-11T22:32:58Z")

</div>

Thanks a lot for sharing the relevant post. I’ll go through it and get back if any queries.
