[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gsl] What I am doing wrong / gsl_interp_polynomial
From: |
Patrick Alken |
Subject: |
Re: [Bug-gsl] What I am doing wrong / gsl_interp_polynomial |
Date: |
Mon, 30 Nov 2015 18:49:41 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
He's interpolating, not least-squares fitting. Therefore to interpolate
N points he needs a polynomial of degree N-1. A least squares approach
might be better since he could interpolate his 1000 points with a much
lower degree polynomial, say 6 or 7.
On 11/30/2015 05:22 PM, Raymond Rogers wrote:
>
> Are you sure you aren't fitting noise? This results in oscillation
> due instantaneous fluctuations shoving high frequency into the model.
>
>
> On Mon, Nov 30, 2015, 6:58 PM Patrick Alken <address@hidden
> <mailto:address@hidden>> wrote:
>
> Hello,
>
> I confirmed that your program is failing for the polynomial
> interpolation, but polynomial interpolation is known to be
> difficult for
> large datasets. From the manual:
>
> ====
> Interpolation Type: gsl_interp_polynomial
>
> Polynomial interpolation. This method should only be used for
> interpolating small numbers of points because polynomial interpolation
> introduces large oscillations, even for well-behaved datasets. The
> number of terms in the interpolating polynomial is equal to the number
> of points.
> ====
>
> So basically you are trying to fit a degree 1000 polynomial to your
> dataset, which will not be numerically stable - even though your
> dataset
> is well behaved.
>
> Cubic splines are probably the way to go here, but if you insist on a
> degree 1000 polynomial (even though you shouldn't) I might be able to
> give you some further ideas.
>
> You mentioned that previous versions of GSL worked for you. Can you
> verify if you used exactly this same dataset successfully with a
> previous version of GSL? If so please tell me the version number.
>
> Thanks,
> Patrick
>
> On 11/30/2015 10:25 AM, Petrus, Adam (UK) wrote:
> > I am attempting to use the polynomial interpolation method with
> GSL. However I am getting very strange results.
> >
> > If I run the attached program I get the below result. If I
> change the method to linear or cspline the interpolation works fine.
> >
> > Not in previous gsl versions the polynomial interpolation has
> worked!
> >
> > [cid:image001.png@01D12B93.B5E118F0]
> >
> > Is there something I am missing?
> >
> > Yours aye
> >
> > Adam
> >
> >
> >
> > ********************************************************************
> > This email and any attachments are confidential to the intended
> > recipient and may also be privileged. If you are not the intended
> > recipient please delete it from your system and notify the sender.
> > You should not copy it or use it for any purpose nor disclose or
> > distribute its contents to any other person.
> > ********************************************************************
>