/* check_deriv.c check against each other */ #include #include #include "deriv.h" #include "nuderiv.h" #undef abs #define abs(x) ((x)<0.0?(-(x)):(x)) int main(int argc, char *argv[]) { double cx[100]; double cxnu[100]; double xg[100]; double h, err; double maxerr = 0.0; int norder = 4; int i, j, npoints; int imax, jmax; printf("check_deriv.c running \n"); h = 1.0; for(npoints=9; npoints<23; npoints++) { for(i=0; imaxerr) {maxerr = err; imax=i; jmax=j;} } printf("n=%d, im=%d, x=%f, r=%f, nu=%f, err=%g \n", npoints, imax, xg[imax], cx[imax], cxnu[imax], cx[imax]-cxnu[imax]); } printf("check_deriv.c ending \n"); return 0; } /* end check_deriv.c */