/* Integrate.c Last Modified 10/07/98 */ /* Call Genz's DCUHRE to integrate a funcion */ #include #include #include #include #include void main(int argc, char *argv[ ]) { int i; long ndim; /* Number of variables in integrand(s) */ long numfun; /* Number of components in the vector integrand function */ double *a; /* Lower limit of integration */ double *b; /* Upper limit of integration */ long minpts; /* Minimum number of funsub calls */ long maxpts; /* Maximum number of funsub calls */ double epsabs; /* Requested absolute error */ double epsrel; /* Requested relative error */ long key; /* Selects integration rule */ long nw; /* Length of work array */ long restar; /* restar = 0, this is the first attempt = 1, continuation of a previous attempt */ double *result; /* An array of the approximation to the integrals */ double *abserr; /* An array of estimates for absolute errors */ long neval; /* Number of function evaluations used */ long ifail; /* Exit condition indicator */ double *work; /* Work array */ double *vecalloc(int nr); char *charalloc(int nr); void func(long *nd, double *arg, long *nf, double *fv); void dcuhre_(long *ndim,long *numfun,double *a,double *b, long *minpts,long *maxpts,void *funsub, double *epsabs,double *epsrel,long *key, long *nw,long *restar,double *result, double *abserr,long *neval,long *ifail, double *work); ndim=5; /* Number of variables in integrand(s) */ numfun=1; /* Number of components in the vector integrand function */ a=vecalloc((int) ndim); /*allocate memory for ndim double vector*/ b=vecalloc((int) ndim); for (i=0;i