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
#include <iostream>
#include <gsl/gsl_vector.h> 
#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>

using namespace std;


int main(int argc, char *argv[])
{    


        double x[1001];
        double y[1001];
        
        
        for(int p=0;p<1001;p++) {
                x[p] = double(p) *0.01;
                y[p] = x[p] *x[p];
        }
        
        gsl_interp_accel* acc ;
        gsl_spline* spline;
        
        //gsl_interp_linear
        //gsl_interp_polynomial
        //gsl_interp_cspline
        
        spline =  gsl_spline_alloc( gsl_interp_polynomial , 1001 );
        acc =gsl_interp_accel_alloc ();
        gsl_spline_init( spline , x , y , 1001 );
        
                        
                for(int p=0;p<1001;p++) {
                        double evaly = gsl_spline_eval( spline , x[p] , acc );
                        if (evaly !=  y[p]) {
                                cout << "Point:" << p << ":" << x[p] << "," << 
y[p] << ","<<  evaly << '\n'; 
                                }
                }
        
        
        
    
}//end of main
    
    
********************************************************************
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.
********************************************************************

Reply via email to