[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Doubt (bug?) in gsl_fit_linear function
From: |
John A. Crow |
Subject: |
Re: [Help-gsl] Doubt (bug?) in gsl_fit_linear function |
Date: |
Sun, 10 Jun 2012 16:59:19 -0600 |
What you're seeing is an artifact of how gsl_fit_linear() is doing its
calculations. Here's an executive summary of what's happening:
o c1 -- the slope -- is being computed as m_dxdy / m_dx2 (see the code for
details). In your case, both numerator and denominator are zero; the 0 / 0
results in NaN for c1.
o c0 -- the intercept -- ought to be 50 in your case, but isn't. That's
because c1 is used in its calculation, so it ends up being NaN too.
There are other ways one might compute the coefficients, but I suspect this
situation was felt to be pathological, so no special handling was built in.
Good luck, and a fair question too.