help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Doubt (bug?) in gsl_fit_linear function


From: Juan Pablo Amorocho D.
Subject: Re: [Help-gsl] Doubt (bug?) in gsl_fit_linear function
Date: Mon, 11 Jun 2012 09:56:58 +0200

What should be (computationally) the value of the intercept in this case?
Nan seems right to me, but the slope /should/ be inf. Any comments?
On Jun 11, 2012 12:59 AM, "John A. Crow" <address@hidden> wrote:

> 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.
>
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]