double t2_xlist[] = { 0.0, 1.0, 3.0, 4.0 }, t2_ylist[] = { -1.0, 1.0/6.0, 19.0/6.0, 3.0 }, /* incorrect values */ t2_Mstart[] = {-1.0, -1.0, -1.0, -1.0 }, /* correct values */ t2_Mlist[] = { 0.0, 1.0, -2.0, 0.0 }; spline t2_dat; t2_dat.length = 4; t2_dat.xlist = t2_xlist; t2_dat.ylist = t2_ylist; t2_dat.Mlist = t2_Mstart; spline_make_natural(&t2_dat); for ( i = 0; i < 4; i++ ) if ( fabs(t2_dat.Mlist[i]-t2_Mlist[i]) > 1e-12 ) { printf("Error in computed Mlist[%d] = %g ", i, t2_dat.Mlist[i]); printf("Exact value: %g\n", t2_Mlist[i]); }