GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
qagi.f
Go to the documentation of this file.
1 subroutine qagi(f,bound,inf,epsabs,epsrel,result,abserr,neval,
2 * ier,limit,lenw,last,iwork,work)
3c***begin prologue qagi
4c***date written 800101 (yymmdd)
5c***revision date 830518 (yymmdd)
6c***category no. h2a3a1,h2a4a1
7c***keywords automatic integrator, infinite intervals,
8c general-purpose, transformation, extrapolation,
9c globally adaptive
10c***author piessens,robert,appl. math. & progr. div. - k.u.leuven
11c de doncker,elise,appl. math. & progr. div. -k.u.leuven
12c***purpose the routine calculates an approximation result to a given
13c integral i = integral of f over (bound,+infinity)
14c or i = integral of f over (-infinity,bound)
15c or i = integral of f over (-infinity,+infinity)
16c hopefully satisfying following claim for accuracy
17c abs(i-result).le.max(epsabs,epsrel*abs(i)).
18c***description
19c
20c integration over infinite intervals
21c standard fortran subroutine
22c
23c parameters
24c on entry
25c f - subroutine f(x,result) defining the integrand
26c function f(x). the actual name for f needs to be
27c declared e x t e r n a l in the driver program.
28c
29c bound - real
30c finite bound of integration range
31c (has no meaning if interval is doubly-infinite)
32c
33c inf - integer
34c indicating the kind of integration range involved
35c inf = 1 corresponds to (bound,+infinity),
36c inf = -1 to (-infinity,bound),
37c inf = 2 to (-infinity,+infinity).
38c
39c epsabs - real
40c absolute accuracy requested
41c epsrel - real
42c relative accuracy requested
43c if epsabs.le.0
44c and epsrel.lt.max(50*rel.mach.acc.,0.5d-28),
45c the routine will end with ier = 6.
46c
47c
48c on return
49c result - real
50c approximation to the integral
51c
52c abserr - real
53c estimate of the modulus of the absolute error,
54c which should equal or exceed abs(i-result)
55c
56c neval - integer
57c number of integrand evaluations
58c
59c ier - integer
60c ier = 0 normal and reliable termination of the
61c routine. it is assumed that the requested
62c accuracy has been achieved.
63c - ier.gt.0 abnormal termination of the routine. the
64c estimates for result and error are less
65c reliable. it is assumed that the requested
66c accuracy has not been achieved.
67c error messages
68c ier = 1 maximum number of subdivisions allowed
69c has been achieved. one can allow more
70c subdivisions by increasing the value of
71c limit (and taking the according dimension
72c adjustments into account). however, if
73c this yields no improvement it is advised
74c to analyze the integrand in order to
75c determine the integration difficulties. if
76c the position of a local difficulty can be
77c determined (e.g. singularity,
78c discontinuity within the interval) one
79c will probably gain from splitting up the
80c interval at this point and calling the
81c integrator on the subranges. if possible,
82c an appropriate special-purpose integrator
83c should be used, which is designed for
84c handling the type of difficulty involved.
85c = 2 the occurrence of roundoff error is
86c detected, which prevents the requested
87c tolerance from being achieved.
88c the error may be under-estimated.
89c = 3 extremely bad integrand behaviour occurs
90c at some points of the integration
91c interval.
92c = 4 the algorithm does not converge.
93c roundoff error is detected in the
94c extrapolation table.
95c it is assumed that the requested tolerance
96c cannot be achieved, and that the returned
97c result is the best which can be obtained.
98c = 5 the integral is probably divergent, or
99c slowly convergent. it must be noted that
100c divergence can occur with any other value
101c of ier.
102c = 6 the input is invalid, because
103c (epsabs.le.0 and
104c epsrel.lt.max(50*rel.mach.acc.,0.5d-28))
105c or limit.lt.1 or leniw.lt.limit*4.
106c result, abserr, neval, last are set to
107c zero. exept when limit or leniw is
108c invalid, iwork(1), work(limit*2+1) and
109c work(limit*3+1) are set to zero, work(1)
110c is set to a and work(limit+1) to b.
111c
112c dimensioning parameters
113c limit - integer
114c dimensioning parameter for iwork
115c limit determines the maximum number of subintervals
116c in the partition of the given integration interval
117c (a,b), limit.ge.1.
118c if limit.lt.1, the routine will end with ier = 6.
119c
120c lenw - integer
121c dimensioning parameter for work
122c lenw must be at least limit*4.
123c if lenw.lt.limit*4, the routine will end
124c with ier = 6.
125c
126c last - integer
127c on return, last equals the number of subintervals
128c produced in the subdivision process, which
129c determines the number of significant elements
130c actually in the work arrays.
131c
132c work arrays
133c iwork - integer
134c vector of dimension at least limit, the first
135c k elements of which contain pointers
136c to the error estimates over the subintervals,
137c such that work(limit*3+iwork(1)),... ,
138c work(limit*3+iwork(k)) form a decreasing
139c sequence, with k = last if last.le.(limit/2+2), and
140c k = limit+1-last otherwise
141c
142c work - real
143c vector of dimension at least lenw
144c on return
145c work(1), ..., work(last) contain the left
146c end points of the subintervals in the
147c partition of (a,b),
148c work(limit+1), ..., work(limit+last) contain
149c the right end points,
150c work(limit*2+1), ...,work(limit*2+last) contain the
151c integral approximations over the subintervals,
152c work(limit*3+1), ..., work(limit*3)
153c contain the error estimates.
154c***references (none)
155c***routines called qagie,xerror
156c***end prologue qagi
157c
158 real abserr, epsabs,epsrel,result,work
159 integer ier,iwork, lenw,limit,lvl,l1,l2,l3,neval
160c
161 dimension iwork(limit),work(lenw)
162c
163 external f
164c
165c check validity of limit and lenw.
166c
167c***first executable statement qagi
168 ier = 6
169 neval = 0
170 last = 0
171 result = 0.0e+00
172 abserr = 0.0e+00
173 if(limit.lt.1.or.lenw.lt.limit*4) go to 10
174c
175c prepare call for qagie.
176c
177 l1 = limit+1
178 l2 = limit+l1
179 l3 = limit+l2
180c
181 call qagie(f,bound,inf,epsabs,epsrel,limit,result,abserr,
182 * neval,ier,work(1),work(l1),work(l2),work(l3),iwork,last)
183c
184c call error handler if necessary.
185c
186 lvl = 0
18710 if(ier.eq.6) lvl = 1
188 if(ier.ne.0) call xerror('abnormal return from qagi',26,ier,lvl)
189 return
190 end
subroutine qagi(f, bound, inf, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work)
Definition qagi.f:3
subroutine qagie(f, bound, inf, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
Definition qagie.f:3
subroutine xerror(messg, nmessg, nerr, level)
Definition xerror.f:2