GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dqagi.f
Go to the documentation of this file.
1  SUBROUTINE dqagi(F,BOUND,INF,EPSABS,EPSREL,RESULT,ABSERR,NEVAL,
2  * IER,LIMIT,LENW,LAST,IWORK,WORK)
3 C***BEGIN PROLOGUE DQAGI
4 C***DATE WRITTEN 800101 (YYMMDD)
5 C***REVISION DATE 830518 (YYMMDD)
6 C***CATEGORY NO. H2A3A1,H2A4A1
7 C***KEYWORDS AUTOMATIC INTEGRATOR, INFINITE INTERVALS,
8 C GENERAL-PURPOSE, TRANSFORMATION, EXTRAPOLATION,
9 C GLOBALLY ADAPTIVE
10 C***AUTHOR PIESSENS,ROBERT,APPL. MATH. & PROGR. DIV. - K.U.LEUVEN
11 C DE DONCKER,ELISE,APPL. MATH. & PROGR. DIV. -K.U.LEUVEN
12 C***PURPOSE THE ROUTINE CALCULATES AN APPROXIMATION RESULT TO A GIVEN
13 C INTEGRAL I = INTEGRAL OF F OVER (BOUND,+INFINITY)
14 C OR I = INTEGRAL OF F OVER (-INFINITY,BOUND)
15 C OR I = INTEGRAL OF F OVER (-INFINITY,+INFINITY)
16 C HOPEFULLY SATISFYING FOLLOWING CLAIM FOR ACCURACY
17 C ABS(I-RESULT).LE.MAX(EPSABS,EPSREL*ABS(I)).
18 C***DESCRIPTION
19 C
20 C INTEGRATION OVER INFINITE INTERVALS
21 C STANDARD FORTRAN SUBROUTINE
22 C
23 C PARAMETERS
24 C ON ENTRY
25 C F - SUBROUTINE F(X,RESULT) DEFINING THE INTEGRAND
26 C FUNCTION F(X). THE ACTUAL NAME FOR F NEEDS TO BE
27 C DECLARED E X T E R N A L IN THE DRIVER PROGRAM.
28 C
29 C BOUND - DOUBLE PRECISION
30 C FINITE BOUND OF INTEGRATION RANGE
31 C (HAS NO MEANING IF INTERVAL IS DOUBLY-INFINITE)
32 C
33 C INF - INTEGER
34 C INDICATING THE KIND OF INTEGRATION RANGE INVOLVED
35 C INF = 1 CORRESPONDS TO (BOUND,+INFINITY),
36 C INF = -1 TO (-INFINITY,BOUND),
37 C INF = 2 TO (-INFINITY,+INFINITY).
38 C
39 C EPSABS - DOUBLE PRECISION
40 C ABSOLUTE ACCURACY REQUESTED
41 C EPSREL - DOUBLE PRECISION
42 C RELATIVE ACCURACY REQUESTED
43 C IF EPSABS.LE.0
44 C AND EPSREL.LT.MAX(50*REL.MACH.ACC.,0.5D-28),
45 C THE ROUTINE WILL END WITH IER = 6.
46 C
47 C
48 C ON RETURN
49 C RESULT - DOUBLE PRECISION
50 C APPROXIMATION TO THE INTEGRAL
51 C
52 C ABSERR - DOUBLE PRECISION
53 C ESTIMATE OF THE MODULUS OF THE ABSOLUTE ERROR,
54 C WHICH SHOULD EQUAL OR EXCEED ABS(I-RESULT)
55 C
56 C NEVAL - INTEGER
57 C NUMBER OF INTEGRAND EVALUATIONS
58 C
59 C IER - INTEGER
60 C IER = 0 NORMAL AND RELIABLE TERMINATION OF THE
61 C ROUTINE. IT IS ASSUMED THAT THE REQUESTED
62 C ACCURACY HAS BEEN ACHIEVED.
63 C - IER.GT.0 ABNORMAL TERMINATION OF THE ROUTINE. THE
64 C ESTIMATES FOR RESULT AND ERROR ARE LESS
65 C RELIABLE. IT IS ASSUMED THAT THE REQUESTED
66 C ACCURACY HAS NOT BEEN ACHIEVED.
67 C ERROR MESSAGES
68 C IER = 1 MAXIMUM NUMBER OF SUBDIVISIONS ALLOWED
69 C HAS BEEN ACHIEVED. ONE CAN ALLOW MORE
70 C SUBDIVISIONS BY INCREASING THE VALUE OF
71 C LIMIT (AND TAKING THE ACCORDING DIMENSION
72 C ADJUSTMENTS INTO ACCOUNT). HOWEVER, IF
73 C THIS YIELDS NO IMPROVEMENT IT IS ADVISED
74 C TO ANALYZE THE INTEGRAND IN ORDER TO
75 C DETERMINE THE INTEGRATION DIFFICULTIES. IF
76 C THE POSITION OF A LOCAL DIFFICULTY CAN BE
77 C DETERMINED (E.G. SINGULARITY,
78 C DISCONTINUITY WITHIN THE INTERVAL) ONE
79 C WILL PROBABLY GAIN FROM SPLITTING UP THE
80 C INTERVAL AT THIS POINT AND CALLING THE
81 C INTEGRATOR ON THE SUBRANGES. IF POSSIBLE,
82 C AN APPROPRIATE SPECIAL-PURPOSE INTEGRATOR
83 C SHOULD BE USED, WHICH IS DESIGNED FOR
84 C HANDLING THE TYPE OF DIFFICULTY INVOLVED.
85 C = 2 THE OCCURRENCE OF ROUNDOFF ERROR IS
86 C DETECTED, WHICH PREVENTS THE REQUESTED
87 C TOLERANCE FROM BEING ACHIEVED.
88 C THE ERROR MAY BE UNDER-ESTIMATED.
89 C = 3 EXTREMELY BAD INTEGRAND BEHAVIOUR OCCURS
90 C AT SOME POINTS OF THE INTEGRATION
91 C INTERVAL.
92 C = 4 THE ALGORITHM DOES NOT CONVERGE.
93 C ROUNDOFF ERROR IS DETECTED IN THE
94 C EXTRAPOLATION TABLE.
95 C IT IS ASSUMED THAT THE REQUESTED TOLERANCE
96 C CANNOT BE ACHIEVED, AND THAT THE RETURNED
97 C RESULT IS THE BEST WHICH CAN BE OBTAINED.
98 C = 5 THE INTEGRAL IS PROBABLY DIVERGENT, OR
99 C SLOWLY CONVERGENT. IT MUST BE NOTED THAT
100 C DIVERGENCE CAN OCCUR WITH ANY OTHER VALUE
101 C OF IER.
102 C = 6 THE INPUT IS INVALID, BECAUSE
103 C (EPSABS.LE.0 AND
104 C EPSREL.LT.MAX(50*REL.MACH.ACC.,0.5D-28))
105 C OR LIMIT.LT.1 OR LENIW.LT.LIMIT*4.
106 C RESULT, ABSERR, NEVAL, LAST ARE SET TO
107 C ZERO. EXEPT WHEN LIMIT OR LENIW IS
108 C INVALID, IWORK(1), WORK(LIMIT*2+1) AND
109 C WORK(LIMIT*3+1) ARE SET TO ZERO, WORK(1)
110 C IS SET TO A AND WORK(LIMIT+1) TO B.
111 C
112 C DIMENSIONING PARAMETERS
113 C LIMIT - INTEGER
114 C DIMENSIONING PARAMETER FOR IWORK
115 C LIMIT DETERMINES THE MAXIMUM NUMBER OF SUBINTERVALS
116 C IN THE PARTITION OF THE GIVEN INTEGRATION INTERVAL
117 C (A,B), LIMIT.GE.1.
118 C IF LIMIT.LT.1, THE ROUTINE WILL END WITH IER = 6.
119 C
120 C LENW - INTEGER
121 C DIMENSIONING PARAMETER FOR WORK
122 C LENW MUST BE AT LEAST LIMIT*4.
123 C IF LENW.LT.LIMIT*4, THE ROUTINE WILL END
124 C WITH IER = 6.
125 C
126 C LAST - INTEGER
127 C ON RETURN, LAST EQUALS THE NUMBER OF SUBINTERVALS
128 C PRODUCED IN THE SUBDIVISION PROCESS, WHICH
129 C DETERMINES THE NUMBER OF SIGNIFICANT ELEMENTS
130 C ACTUALLY IN THE WORK ARRAYS.
131 C
132 C WORK ARRAYS
133 C IWORK - INTEGER
134 C VECTOR OF DIMENSION AT LEAST LIMIT, THE FIRST
135 C K ELEMENTS OF WHICH CONTAIN POINTERS
136 C TO THE ERROR ESTIMATES OVER THE SUBINTERVALS,
137 C SUCH THAT WORK(LIMIT*3+IWORK(1)),... ,
138 C WORK(LIMIT*3+IWORK(K)) FORM A DECREASING
139 C SEQUENCE, WITH K = LAST IF LAST.LE.(LIMIT/2+2), AND
140 C K = LIMIT+1-LAST OTHERWISE
141 C
142 C WORK - DOUBLE PRECISION
143 C VECTOR OF DIMENSION AT LEAST LENW
144 C ON RETURN
145 C WORK(1), ..., WORK(LAST) CONTAIN THE LEFT
146 C END POINTS OF THE SUBINTERVALS IN THE
147 C PARTITION OF (A,B),
148 C WORK(LIMIT+1), ..., WORK(LIMIT+LAST) CONTAIN
149 C THE RIGHT END POINTS,
150 C WORK(LIMIT*2+1), ...,WORK(LIMIT*2+LAST) CONTAIN THE
151 C INTEGRAL APPROXIMATIONS OVER THE SUBINTERVALS,
152 C WORK(LIMIT*3+1), ..., WORK(LIMIT*3)
153 C CONTAIN THE ERROR ESTIMATES.
154 C***REFERENCES (NONE)
155 C***ROUTINES CALLED DQAGIE,XERROR
156 C***END PROLOGUE DQAGI
157 C
158  DOUBLE PRECISION ABSERR,BOUND,EPSABS,EPSREL,RESULT,WORK
159  INTEGER IER,INF,IWORK,LAST,LENW,LIMIT,LVL,L1,L2,L3,NEVAL
160 C
161  dimension iwork(limit),work(lenw)
162 C
163  EXTERNAL f
164 C
165 C CHECK VALIDITY OF LIMIT AND LENW.
166 C
167 C***FIRST EXECUTABLE STATEMENT DQAGI
168  ier = 6
169  neval = 0
170  last = 0
171  result = 0.0d+00
172  abserr = 0.0d+00
173  IF(limit.LT.1.OR.lenw.LT.limit*4) GO TO 10
174 C
175 C PREPARE CALL FOR DQAGIE.
176 C
177  l1 = limit+1
178  l2 = limit+l1
179  l3 = limit+l2
180 C
181  CALL dqagie(f,bound,inf,epsabs,epsrel,limit,result,abserr,
182  * neval,ier,work(1),work(l1),work(l2),work(l3),iwork,last)
183 C
184 C CALL ERROR HANDLER IF NECESSARY.
185 C
186  lvl = 0
187 10 IF(ier.EQ.6) lvl = 1
188  IF(ier.GT.0) CALL xerror('ABNORMAL RETURN FROM DQAGI',26,ier,lvl)
189  RETURN
190  END
subroutine dqagi(F, BOUND, INF, EPSABS, EPSREL, RESULT, ABSERR, NEVAL, IER, LIMIT, LENW, LAST, IWORK, WORK)
Definition: dqagi.f:3
subroutine dqagie(F, BOUND, INF, EPSABS, EPSREL, LIMIT, RESULT, ABSERR, NEVAL, IER, ALIST, BLIST, RLIST, ELIST, IORD, LAST)
Definition: dqagie.f:3
subroutine xerror(MESSG, NMESSG, NERR, LEVEL)
Definition: xerror.f:2