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 <[email protected] > <mailto:[email protected]>> 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:[email protected]] > > > > 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. > > ******************************************************************** >
