#include #include #include #include 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