Thanks for your prompt replies! It is a general application where the user chooses the method of interpolation. I have modified it so if the user chooses the polynomial option and there is more than 64 points it now does not display the option or sets the method to spline. Thanks for the suggestion of the least squares approach.
Yours aye Adam From: Raymond Rogers [mailto:[email protected]] Sent: 01 December 2015 04:37 To: Patrick Alken; [email protected]; Petrus, Adam (UK) Subject: Re: [Bug-gsl] What I am doing wrong / gsl_interp_polynomial *** WARNING *** This message originates from outside our organisation, either from an external partner or the internet. Consider carefully whether you should click on any links, open any attachments or reply. For information regarding Red Flags that you can look out for in emails you receive, click here<http://intranet.ent.baesystems.com/howwework/security/spotlights/Documents/Red%20Flags.pdf>. If you feel the email is suspicious, please follow this process<http://intranet.ent.baesystems.com/howwework/security/spotlights/Documents/Dealing%20With%20Suspicious%20Emails.pdf>. Thanks for the clarification. There are several other ways to approach that; but without knowledge of the application there is no way to choose. On Mon, Nov 30, 2015, 8:49 PM Patrick Alken <[email protected]<mailto:[email protected]>> wrote: 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. > ********************************************************************
