/*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_dint1r s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dint1r.h" /* program DRDINT1R *>> 1994-10-19 DRDINT1R Krogh Changes to use M77CON *>> 1994-08-08 DRDINT1R Snyder Took '0' out of formats for C conversion *>> 1991-11-20 CLL Edited for Fortran 90. *>> 1987-12-09 DRDINT1R Snyder Initial Code. *--D replaces "?": DR?INT1R, ?INT1, ?INTA * * 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 using reverse communication. * */ 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 DRDINT1R:\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] = 6; Iopt[5] = 0; dint1( a, b, &answer, work, iopt ); L_30: ; dinta( &answer, work, iopt ); if (Iopt[1] == 0) { answer = sin( Work[1] ); goto L_30; } 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 */