EXTERNAL FTEST * * ADAPT EXAMPLE TEST PROGRAM * INTEGER N, MNCLS, MXCLS, IFAIL, NV, ND, NF, LW, KEY PARAMETER (ND = 3, NF = 5, LW = 10000 ) DOUBLE PRECISION A(ND), B(ND), WRKSTR(LW), ABSEST(NF), FINEST(NF) DO N = 1, ND A(N) = 0 B(N) = 1 END DO KEY = 1 MNCLS = 0 MXCLS = 1000 CALL ADAPT(ND, NF, A, B, MNCLS, MXCLS, FTEST, 1D-5, 0, * KEY, LW, 0, FINEST, ABSEST, NV, IFAIL, WRKSTR) PRINT 99999, KEY, NV, IFAIL 99999 FORMAT (5X, 'ADAPT TEST RESULTS, WITH KEY =', I2, * /' FTEST CALLS = ', I5, ', IFAIL = ', I2, * /' N ESTIMATED ERROR INTEGRAL') DO N = 1 , NF PRINT '(3X, I2, 2E15.6)', N, ABSEST(N), FINEST(N) END DO KEY = 2 CALL ADAPT(ND, NF, A, B, MNCLS, 10*MXCLS, FTEST, 1D-5, 0, * KEY, LW, 1, FINEST, ABSEST, NV, IFAIL, WRKSTR) PRINT *, ' CONTINUATION OF CALCULATION' PRINT 99999, KEY, NV, IFAIL DO N = 1 , NF PRINT '(3X, I2, 2E15.6)', N, ABSEST(N), FINEST(N) END DO END SUBROUTINE FTEST(NDIM, Z, NFUN, F) INTEGER N, NDIM, NFUN DOUBLE PRECISION Z(NDIM), F(NFUN), SUM DO N = 1, NDIM F(N) = Z(N)**(N+2) END DO F(4) = COS(5*Z(3)**2) F(5) = EXP(5*Z(2)**2) END