qpdoc.f 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. *DECK QPDOC
  2. SUBROUTINE QPDOC
  3. C***BEGIN PROLOGUE QPDOC
  4. C***PURPOSE Documentation for QUADPACK, a package of subprograms for
  5. C automatic evaluation of one-dimensional definite integrals.
  6. C***LIBRARY SLATEC (QUADPACK)
  7. C***CATEGORY H2, Z
  8. C***TYPE ALL (QPDOC-A)
  9. C***KEYWORDS DOCUMENTATION, GUIDELINES FOR SELECTION, QUADPACK,
  10. C QUADRATURE, SURVEY OF INTEGRATORS
  11. C***AUTHOR Piessens, Robert
  12. C Applied Mathematics and Programming Division
  13. C K. U. Leuven
  14. C de Doncker, Elise
  15. C Applied Mathematics and Programming Division
  16. C K. U. Leuven
  17. C Kahaner, D. K., (NBS)
  18. C***DESCRIPTION
  19. C
  20. C 1. Introduction
  21. C ------------
  22. C QUADPACK is a FORTRAN subroutine package for the numerical
  23. C computation of definite one-dimensional integrals. It originated
  24. C from a joint project of R. Piessens and E. de Doncker (Appl.
  25. C Math. and Progr. Div.- K.U.Leuven, Belgium), C. Ueberhuber (Inst.
  26. C Fuer Math.- Techn. U. Wien, Austria), and D. Kahaner (National
  27. C Bureau of Standards- Washington D.C., U.S.A.).
  28. C
  29. C Documentation routine QPDOC describes the package in the form it
  30. C was released from A.M.P.D.- Leuven, for adherence to the SLATEC
  31. C library in May 1981. Apart from a survey of the integrators, some
  32. C guidelines will be given in order to help the QUADPACK user with
  33. C selecting an appropriate routine or a combination of several
  34. C routines for handling his problem.
  35. C
  36. C In the Long Description of QPDOC it is demonstrated how to call
  37. C the integrators, by means of small example calling programs.
  38. C
  39. C For precise guidelines involving the use of each routine in
  40. C particular, we refer to the extensive introductory comments
  41. C within each routine.
  42. C
  43. C 2. Survey
  44. C ------
  45. C The following list gives an overview of the QUADPACK integrators.
  46. C The routine names for the DOUBLE PRECISION versions are preceded
  47. C by the letter D.
  48. C
  49. C - QNG : Is a simple non-adaptive automatic integrator, based on
  50. C a sequence of rules with increasing degree of algebraic
  51. C precision (Patterson, 1968).
  52. C
  53. C - QAG : Is a simple globally adaptive integrator using the
  54. C strategy of Aind (Piessens, 1973). It is possible to
  55. C choose between 6 pairs of Gauss-Kronrod quadrature
  56. C formulae for the rule evaluation component. The pairs
  57. C of high degree of precision are suitable for handling
  58. C integration difficulties due to a strongly oscillating
  59. C integrand.
  60. C
  61. C - QAGS : Is an integrator based on globally adaptive interval
  62. C subdivision in connection with extrapolation (de Doncker,
  63. C 1978) by the Epsilon algorithm (Wynn, 1956).
  64. C
  65. C - QAGP : Serves the same purposes as QAGS, but also allows
  66. C for eventual user-supplied information, i.e. the
  67. C abscissae of internal singularities, discontinuities
  68. C and other difficulties of the integrand function.
  69. C The algorithm is a modification of that in QAGS.
  70. C
  71. C - QAGI : Handles integration over infinite intervals. The
  72. C infinite range is mapped onto a finite interval and
  73. C then the same strategy as in QAGS is applied.
  74. C
  75. C - QAWO : Is a routine for the integration of COS(OMEGA*X)*F(X)
  76. C or SIN(OMEGA*X)*F(X) over a finite interval (A,B).
  77. C OMEGA is is specified by the user
  78. C The rule evaluation component is based on the
  79. C modified Clenshaw-Curtis technique.
  80. C An adaptive subdivision scheme is used connected with
  81. C an extrapolation procedure, which is a modification
  82. C of that in QAGS and provides the possibility to deal
  83. C even with singularities in F.
  84. C
  85. C - QAWF : Calculates the Fourier cosine or Fourier sine
  86. C transform of F(X), for user-supplied interval (A,
  87. C INFINITY), OMEGA, and F. The procedure of QAWO is
  88. C used on successive finite intervals, and convergence
  89. C acceleration by means of the Epsilon algorithm (Wynn,
  90. C 1956) is applied to the series of the integral
  91. C contributions.
  92. C
  93. C - QAWS : Integrates W(X)*F(X) over (A,B) with A.LT.B finite,
  94. C and W(X) = ((X-A)**ALFA)*((B-X)**BETA)*V(X)
  95. C where V(X) = 1 or LOG(X-A) or LOG(B-X)
  96. C or LOG(X-A)*LOG(B-X)
  97. C and ALFA.GT.(-1), BETA.GT.(-1).
  98. C The user specifies A, B, ALFA, BETA and the type of
  99. C the function V.
  100. C A globally adaptive subdivision strategy is applied,
  101. C with modified Clenshaw-Curtis integration on the
  102. C subintervals which contain A or B.
  103. C
  104. C - QAWC : Computes the Cauchy Principal Value of F(X)/(X-C)
  105. C over a finite interval (A,B) and for
  106. C user-determined C.
  107. C The strategy is globally adaptive, and modified
  108. C Clenshaw-Curtis integration is used on the subranges
  109. C which contain the point X = C.
  110. C
  111. C Each of the routines above also has a "more detailed" version
  112. C with a name ending in E, as QAGE. These provide more
  113. C information and control than the easier versions.
  114. C
  115. C
  116. C The preceding routines are all automatic. That is, the user
  117. C inputs his problem and an error tolerance. The routine
  118. C attempts to perform the integration to within the requested
  119. C absolute or relative error.
  120. C There are, in addition, a number of non-automatic integrators.
  121. C These are most useful when the problem is such that the
  122. C user knows that a fixed rule will provide the accuracy
  123. C required. Typically they return an error estimate but make
  124. C no attempt to satisfy any particular input error request.
  125. C
  126. C QK15
  127. C QK21
  128. C QK31
  129. C QK41
  130. C QK51
  131. C QK61
  132. C Estimate the integral on [a,b] using 15, 21,..., 61
  133. C point rule and return an error estimate.
  134. C QK15I 15 point rule for (semi)infinite interval.
  135. C QK15W 15 point rule for special singular weight functions.
  136. C QC25C 25 point rule for Cauchy Principal Values
  137. C QC25F 25 point rule for sin/cos integrand.
  138. C QMOMO Integrates k-th degree Chebyshev polynomial times
  139. C function with various explicit singularities.
  140. C
  141. C 3. Guidelines for the use of QUADPACK
  142. C ----------------------------------
  143. C Here it is not our purpose to investigate the question when
  144. C automatic quadrature should be used. We shall rather attempt
  145. C to help the user who already made the decision to use QUADPACK,
  146. C with selecting an appropriate routine or a combination of
  147. C several routines for handling his problem.
  148. C
  149. C For both quadrature over finite and over infinite intervals,
  150. C one of the first questions to be answered by the user is
  151. C related to the amount of computer time he wants to spend,
  152. C versus his -own- time which would be needed, for example, for
  153. C manual subdivision of the interval or other analytic
  154. C manipulations.
  155. C
  156. C (1) The user may not care about computer time, or not be
  157. C willing to do any analysis of the problem. especially when
  158. C only one or a few integrals must be calculated, this attitude
  159. C can be perfectly reasonable. In this case it is clear that
  160. C either the most sophisticated of the routines for finite
  161. C intervals, QAGS, must be used, or its analogue for infinite
  162. C intervals, GAGI. These routines are able to cope with
  163. C rather difficult, even with improper integrals.
  164. C This way of proceeding may be expensive. But the integrator
  165. C is supposed to give you an answer in return, with additional
  166. C information in the case of a failure, through its error
  167. C estimate and flag. Yet it must be stressed that the programs
  168. C cannot be totally reliable.
  169. C ------
  170. C
  171. C (2) The user may want to examine the integrand function.
  172. C If bad local difficulties occur, such as a discontinuity, a
  173. C singularity, derivative singularity or high peak at one or
  174. C more points within the interval, the first advice is to
  175. C split up the interval at these points. The integrand must
  176. C then be examined over each of the subintervals separately,
  177. C so that a suitable integrator can be selected for each of
  178. C them. If this yields problems involving relative accuracies
  179. C to be imposed on -finite- subintervals, one can make use of
  180. C QAGP, which must be provided with the positions of the local
  181. C difficulties. However, if strong singularities are present
  182. C and a high accuracy is requested, application of QAGS on the
  183. C subintervals may yield a better result.
  184. C
  185. C For quadrature over finite intervals we thus dispose of QAGS
  186. C and
  187. C - QNG for well-behaved integrands,
  188. C - QAG for functions with an oscillating behaviour of a non
  189. C specific type,
  190. C - QAWO for functions, eventually singular, containing a
  191. C factor COS(OMEGA*X) or SIN(OMEGA*X) where OMEGA is known,
  192. C - QAWS for integrands with Algebraico-Logarithmic end point
  193. C singularities of known type,
  194. C - QAWC for Cauchy Principal Values.
  195. C
  196. C Remark
  197. C ------
  198. C On return, the work arrays in the argument lists of the
  199. C adaptive integrators contain information about the interval
  200. C subdivision process and hence about the integrand behaviour:
  201. C the end points of the subintervals, the local integral
  202. C contributions and error estimates, and eventually other
  203. C characteristics. For this reason, and because of its simple
  204. C globally adaptive nature, the routine QAG in particular is
  205. C well-suited for integrand examination. Difficult spots can
  206. C be located by investigating the error estimates on the
  207. C subintervals.
  208. C
  209. C For infinite intervals we provide only one general-purpose
  210. C routine, QAGI. It is based on the QAGS algorithm applied
  211. C after a transformation of the original interval into (0,1).
  212. C Yet it may eventuate that another type of transformation is
  213. C more appropriate, or one might prefer to break up the
  214. C original interval and use QAGI only on the infinite part
  215. C and so on. These kinds of actions suggest a combined use of
  216. C different QUADPACK integrators. Note that, when the only
  217. C difficulty is an integrand singularity at the finite
  218. C integration limit, it will in general not be necessary to
  219. C break up the interval, as QAGI deals with several types of
  220. C singularity at the boundary point of the integration range.
  221. C It also handles slowly convergent improper integrals, on
  222. C the condition that the integrand does not oscillate over
  223. C the entire infinite interval. If it does we would advise
  224. C to sum succeeding positive and negative contributions to
  225. C the integral -e.g. integrate between the zeros- with one
  226. C or more of the finite-range integrators, and apply
  227. C convergence acceleration eventually by means of QUADPACK
  228. C subroutine QELG which implements the Epsilon algorithm.
  229. C Such quadrature problems include the Fourier transform as
  230. C a special case. Yet for the latter we have an automatic
  231. C integrator available, QAWF.
  232. C
  233. C *Long Description:
  234. C
  235. C 4. Example Programs
  236. C ----------------
  237. C 4.1. Calling Program for QNG
  238. C -----------------------
  239. C
  240. C REAL A,ABSERR,B,F,EPSABS,EPSREL,RESULT
  241. C INTEGER IER,NEVAL
  242. C EXTERNAL F
  243. C A = 0.0E0
  244. C B = 1.0E0
  245. C EPSABS = 0.0E0
  246. C EPSREL = 1.0E-3
  247. C CALL QNG(F,A,B,EPSABS,EPSREL,RESULT,ABSERR,NEVAL,IER)
  248. C C INCLUDE WRITE STATEMENTS
  249. C STOP
  250. C END
  251. C C
  252. C REAL FUNCTION F(X)
  253. C REAL X
  254. C F = EXP(X)/(X*X+0.1E+01)
  255. C RETURN
  256. C END
  257. C
  258. C 4.2. Calling Program for QAG
  259. C -----------------------
  260. C
  261. C REAL A,ABSERR,B,EPSABS,EPSREL,F,RESULT,WORK
  262. C INTEGER IER,IWORK,KEY,LAST,LENW,LIMIT,NEVAL
  263. C DIMENSION IWORK(100),WORK(400)
  264. C EXTERNAL F
  265. C A = 0.0E0
  266. C B = 1.0E0
  267. C EPSABS = 0.0E0
  268. C EPSREL = 1.0E-3
  269. C KEY = 6
  270. C LIMIT = 100
  271. C LENW = LIMIT*4
  272. C CALL QAG(F,A,B,EPSABS,EPSREL,KEY,RESULT,ABSERR,NEVAL,
  273. C * IER,LIMIT,LENW,LAST,IWORK,WORK)
  274. C C INCLUDE WRITE STATEMENTS
  275. C STOP
  276. C END
  277. C C
  278. C REAL FUNCTION F(X)
  279. C REAL X
  280. C F = 2.0E0/(2.0E0+SIN(31.41592653589793E0*X))
  281. C RETURN
  282. C END
  283. C
  284. C 4.3. Calling Program for QAGS
  285. C ------------------------
  286. C
  287. C REAL A,ABSERR,B,EPSABS,EPSREL,F,RESULT,WORK
  288. C INTEGER IER,IWORK,LAST,LENW,LIMIT,NEVAL
  289. C DIMENSION IWORK(100),WORK(400)
  290. C EXTERNAL F
  291. C A = 0.0E0
  292. C B = 1.0E0
  293. C EPSABS = 0.0E0
  294. C EPSREL = 1.0E-3
  295. C LIMIT = 100
  296. C LENW = LIMIT*4
  297. C CALL QAGS(F,A,B,EPSABS,EPSREL,RESULT,ABSERR,NEVAL,IER,
  298. C * LIMIT,LENW,LAST,IWORK,WORK)
  299. C C INCLUDE WRITE STATEMENTS
  300. C STOP
  301. C END
  302. C C
  303. C REAL FUNCTION F(X)
  304. C REAL X
  305. C F = 0.0E0
  306. C IF(X.GT.0.0E0) F = 1.0E0/SQRT(X)
  307. C RETURN
  308. C END
  309. C
  310. C 4.4. Calling Program for QAGP
  311. C ------------------------
  312. C
  313. C REAL A,ABSERR,B,EPSABS,EPSREL,F,POINTS,RESULT,WORK
  314. C INTEGER IER,IWORK,LAST,LENIW,LENW,LIMIT,NEVAL,NPTS2
  315. C DIMENSION IWORK(204),POINTS(4),WORK(404)
  316. C EXTERNAL F
  317. C A = 0.0E0
  318. C B = 1.0E0
  319. C NPTS2 = 4
  320. C POINTS(1) = 1.0E0/7.0E0
  321. C POINTS(2) = 2.0E0/3.0E0
  322. C LIMIT = 100
  323. C LENIW = LIMIT*2+NPTS2
  324. C LENW = LIMIT*4+NPTS2
  325. C CALL QAGP(F,A,B,NPTS2,POINTS,EPSABS,EPSREL,RESULT,ABSERR,
  326. C * NEVAL,IER,LENIW,LENW,LAST,IWORK,WORK)
  327. C C INCLUDE WRITE STATEMENTS
  328. C STOP
  329. C END
  330. C C
  331. C REAL FUNCTION F(X)
  332. C REAL X
  333. C F = 0.0E+00
  334. C IF(X.NE.1.0E0/7.0E0.AND.X.NE.2.0E0/3.0E0) F =
  335. C * ABS(X-1.0E0/7.0E0)**(-0.25E0)*
  336. C * ABS(X-2.0E0/3.0E0)**(-0.55E0)
  337. C RETURN
  338. C END
  339. C
  340. C 4.5. Calling Program for QAGI
  341. C ------------------------
  342. C
  343. C REAL ABSERR,BOUN,EPSABS,EPSREL,F,RESULT,WORK
  344. C INTEGER IER,INF,IWORK,LAST,LENW,LIMIT,NEVAL
  345. C DIMENSION IWORK(100),WORK(400)
  346. C EXTERNAL F
  347. C BOUN = 0.0E0
  348. C INF = 1
  349. C EPSABS = 0.0E0
  350. C EPSREL = 1.0E-3
  351. C LIMIT = 100
  352. C LENW = LIMIT*4
  353. C CALL QAGI(F,BOUN,INF,EPSABS,EPSREL,RESULT,ABSERR,NEVAL,
  354. C * IER,LIMIT,LENW,LAST,IWORK,WORK)
  355. C C INCLUDE WRITE STATEMENTS
  356. C STOP
  357. C END
  358. C C
  359. C REAL FUNCTION F(X)
  360. C REAL X
  361. C F = 0.0E0
  362. C IF(X.GT.0.0E0) F = SQRT(X)*LOG(X)/
  363. C * ((X+1.0E0)*(X+2.0E0))
  364. C RETURN
  365. C END
  366. C
  367. C 4.6. Calling Program for QAWO
  368. C ------------------------
  369. C
  370. C REAL A,ABSERR,B,EPSABS,EPSREL,F,RESULT,OMEGA,WORK
  371. C INTEGER IER,INTEGR,IWORK,LAST,LENIW,LENW,LIMIT,MAXP1,NEVAL
  372. C DIMENSION IWORK(200),WORK(925)
  373. C EXTERNAL F
  374. C A = 0.0E0
  375. C B = 1.0E0
  376. C OMEGA = 10.0E0
  377. C INTEGR = 1
  378. C EPSABS = 0.0E0
  379. C EPSREL = 1.0E-3
  380. C LIMIT = 100
  381. C LENIW = LIMIT*2
  382. C MAXP1 = 21
  383. C LENW = LIMIT*4+MAXP1*25
  384. C CALL QAWO(F,A,B,OMEGA,INTEGR,EPSABS,EPSREL,RESULT,ABSERR,
  385. C * NEVAL,IER,LENIW,MAXP1,LENW,LAST,IWORK,WORK)
  386. C C INCLUDE WRITE STATEMENTS
  387. C STOP
  388. C END
  389. C C
  390. C REAL FUNCTION F(X)
  391. C REAL X
  392. C F = 0.0E0
  393. C IF(X.GT.0.0E0) F = EXP(-X)*LOG(X)
  394. C RETURN
  395. C END
  396. C
  397. C 4.7. Calling Program for QAWF
  398. C ------------------------
  399. C
  400. C REAL A,ABSERR,EPSABS,F,RESULT,OMEGA,WORK
  401. C INTEGER IER,INTEGR,IWORK,LAST,LENIW,LENW,LIMIT,LIMLST,
  402. C * LST,MAXP1,NEVAL
  403. C DIMENSION IWORK(250),WORK(1025)
  404. C EXTERNAL F
  405. C A = 0.0E0
  406. C OMEGA = 8.0E0
  407. C INTEGR = 2
  408. C EPSABS = 1.0E-3
  409. C LIMLST = 50
  410. C LIMIT = 100
  411. C LENIW = LIMIT*2+LIMLST
  412. C MAXP1 = 21
  413. C LENW = LENIW*2+MAXP1*25
  414. C CALL QAWF(F,A,OMEGA,INTEGR,EPSABS,RESULT,ABSERR,NEVAL,
  415. C * IER,LIMLST,LST,LENIW,MAXP1,LENW,IWORK,WORK)
  416. C C INCLUDE WRITE STATEMENTS
  417. C STOP
  418. C END
  419. C C
  420. C REAL FUNCTION F(X)
  421. C REAL X
  422. C IF(X.GT.0.0E0) F = SIN(50.0E0*X)/(X*SQRT(X))
  423. C RETURN
  424. C END
  425. C
  426. C 4.8. Calling Program for QAWS
  427. C ------------------------
  428. C
  429. C REAL A,ABSERR,ALFA,B,BETA,EPSABS,EPSREL,F,RESULT,WORK
  430. C INTEGER IER,INTEGR,IWORK,LAST,LENW,LIMIT,NEVAL
  431. C DIMENSION IWORK(100),WORK(400)
  432. C EXTERNAL F
  433. C A = 0.0E0
  434. C B = 1.0E0
  435. C ALFA = -0.5E0
  436. C BETA = -0.5E0
  437. C INTEGR = 1
  438. C EPSABS = 0.0E0
  439. C EPSREL = 1.0E-3
  440. C LIMIT = 100
  441. C LENW = LIMIT*4
  442. C CALL QAWS(F,A,B,ALFA,BETA,INTEGR,EPSABS,EPSREL,RESULT,
  443. C * ABSERR,NEVAL,IER,LIMIT,LENW,LAST,IWORK,WORK)
  444. C C INCLUDE WRITE STATEMENTS
  445. C STOP
  446. C END
  447. C C
  448. C REAL FUNCTION F(X)
  449. C REAL X
  450. C F = SIN(10.0E0*X)
  451. C RETURN
  452. C END
  453. C
  454. C 4.9. Calling Program for QAWC
  455. C ------------------------
  456. C
  457. C REAL A,ABSERR,B,C,EPSABS,EPSREL,F,RESULT,WORK
  458. C INTEGER IER,IWORK,LAST,LENW,LIMIT,NEVAL
  459. C DIMENSION IWORK(100),WORK(400)
  460. C EXTERNAL F
  461. C A = -1.0E0
  462. C B = 1.0E0
  463. C C = 0.5E0
  464. C EPSABS = 0.0E0
  465. C EPSREL = 1.0E-3
  466. C LIMIT = 100
  467. C LENW = LIMIT*4
  468. C CALL QAWC(F,A,B,C,EPSABS,EPSREL,RESULT,ABSERR,NEVAL,
  469. C * IER,LIMIT,LENW,LAST,IWORK,WORK)
  470. C C INCLUDE WRITE STATEMENTS
  471. C STOP
  472. C END
  473. C C
  474. C REAL FUNCTION F(X)
  475. C REAL X
  476. C F = 1.0E0/(X*X+1.0E-4)
  477. C RETURN
  478. C END
  479. C
  480. C***REFERENCES (NONE)
  481. C***ROUTINES CALLED (NONE)
  482. C***REVISION HISTORY (YYMMDD)
  483. C 810401 DATE WRITTEN
  484. C 890531 Changed all specific intrinsics to generic. (WRB)
  485. C 890531 REVISION DATE from Version 3.2
  486. C 891214 Prologue converted to Version 4.0 format. (BAB)
  487. C 900723 PURPOSE section revised. (WRB)
  488. C***END PROLOGUE QPDOC
  489. C***FIRST EXECUTABLE STATEMENT QPDOC
  490. RETURN
  491. END