/*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_dint1f s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dint1f.h" /* DRDINT1F *>> 2000-12-03 DRDINT1F Krogh Declared WORK as WORK(1) in DINTF. *>> 1994-11-02 DRDINT1F Krogh Changes to use M77CON *>> 1994-08-08 DRDINT1F Snyder Took '0' out of formats for C conversion *>> 1993-05-05 DRDINT1F Krogh Adjusted to simplify conversion to C. *>> 1987-12-09 DRDINT1F Snyder Initial Code. *--D replaces "?": DR?INT1f, ?INT1, ?INTF * * DEMO DRIVER for 1 dimensional quadrature subprogram DINT1. * * Compute the integral for X = 0.0 to X = PI of SIN(X), then * subtract 2.0 from the ANSWER. The result should be zero. * * The integrand is evaluated by the subprogram DINTF. * * */ int main( ) { long int iopt[10]; double a, answer, b, work[1]; /* OFFSET Vectors w/subscript range: 1 to dimension */ long *const Iopt = &iopt[0] - 1; double *const Work = &work[0] - 1; /* end of OFFSET VECTORS */ printf("\n DRDINT1F:\n Compute the integral for X = 0.0 to X = PI of SIN(X), then\n subtract 2.0 from the ANSWER. The result should be zero.\n"); a = 0.0e0; b = 4.0e0*atan( 1.0e0 ); Iopt[2] = 10; Iopt[3] = 0; Iopt[4] = 0; dint1( a, b, &answer, work, iopt ); answer -= 2.0e0; printf("\n ANSWER =%15.8g\n ERROR ESTIMATE =%15.8g\n STATUS FLAG =%6ld\n FUNCTION VALUES =%6ld\n", answer, Work[1], Iopt[1], Iopt[3]); exit(0); } /* end of function */ /* End of DRDINT1F */ void /*FUNCTION*/ dintf( double *answer, double work[], long *iflag) { /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const Work = &work[0] - 1; /* end of OFFSET VECTORS */ /* Subroutine to provide integrand for DINT1. * */ /* IFLAG is not used in this example. * */ *answer = sin( Work[1] ); return; } /* end of function */