/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:10 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_dhint s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dhint.h" /* program DRDHINT *>> 1996-05-28 DRDHINT Krogh Added external statement. *>> 1994-10-19 DRDHINT Krogh Changes to use M77CON *>> 1987-12-09 DRDHINT Lawson Initial Code. *--D replaces "?": DR?HINT, ?HINT * */ int main( ) { long int i, j; double x, yint, ypint, yptab[3], ytab[3], ytrue; static double xtab[3]={0.e0,.5e0,.75e0}; static long ntab = 3; /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const Xtab = &xtab[0] - 1; double *const Yptab = &yptab[0] - 1; double *const Ytab = &ytab[0] - 1; /* end of OFFSET VECTORS */ for (i = 1; i <= 3; i++) { Ytab[i] = exp( Xtab[i] ); Yptab[i] = Ytab[i]; } printf(" Demonstration of DHINT by interpolating to the exponential function,\n given values at X = 0.0, 0.5, and 0.75\n\n X YTRUE YINT YINT-YTRUE YPINT YPINT-YTRUE\n \n"); for (j = 10; j <= 110; j += 5) { x = (double)( j )/100.e0 - 0.1e0; yint = dhint( x, 0, ntab, xtab, ytab, yptab ); ypint = dhint( x, 1, ntab, xtab, ytab, yptab ); ytrue = exp( x ); printf(" %5.2f%13.6f%13.6f%13.6f%13.6f%13.6f\n", x, ytrue, yint, yint - ytrue, ypint, ypint - ytrue); } exit(0); } /* end of function */