EFTCAMB  Reference documentation for version 3.0
02_quadpack_double.f90
Go to the documentation of this file.
1 !----------------------------------------------------------------------------------------
2 !
3 ! This file is part of EFTCAMB.
4 !
5 ! Copyright (C) 2013-2016 by the EFTCAMB authors
6 !
7 ! The EFTCAMB code is free software;
8 ! You can use it, redistribute it, and/or modify it under the terms
9 ! of the GNU General Public License as published by the Free Software Foundation;
10 ! either version 3 of the License, or (at your option) any later version.
11 ! The full text of the license can be found in the file eftcamb/LICENSE at
12 ! the top level of the EFTCAMB distribution.
13 !
14 !----------------------------------------------------------------------------------------
15 
20 
21 
22 !----------------------------------------------------------------------------------------
24 
26 
28 
29  implicit none
30 
31 contains
32 
33  !----------------------------------------------------------------------------------------
40  subroutine xerror ( xmess, nmess, nerr, level )
41 
42  implicit none
43 
44  integer ( kind = 4 ) level
45  integer ( kind = 4 ) nerr
46  integer ( kind = 4 ) nmess
47  character ( len = * ) xmess
48 
49  if ( 1 <= level ) then
50  WRITE ( *,'(1X,A)') xmess(1:nmess)
51  WRITE ( *,'('' ERROR NUMBER = '',I5,'', MESSAGE LEVEL = '',I5)') &
52  nerr, level
53  end if
54 
55  return
56 
57  end subroutine xerror
58 
59  !----------------------------------------------------------------------------------------
70  function dqwgts ( x, a, b, alfa, beta, integr )
71 
72  implicit none
73 
74  real ( kind = 8 ) dqwgts
75  real ( kind = 8 ) a,alfa,b,beta,bmx,x,xma
76  integer ( kind = 4 ) integr
77 
78  xma = x - a
79  bmx = b - x
80  dqwgts = xma ** alfa * bmx ** beta
81  go to (40,10,20,30),integr
82 10 dqwgts = dqwgts* log( xma )
83  go to 40
84 20 dqwgts = dqwgts* log( bmx )
85  go to 40
86 30 dqwgts = dqwgts* log( xma ) * log( bmx )
87 40 continue
88 
89  return
90 end function dqwgts
91 
92 !----------------------------------------------------------------------------------------
103 function dqwgtc ( x, c, p2, p3, p4, kp )
105  implicit none
106 
107  real ( kind = 8 ) dqwgtc
108  real ( kind = 8 ) c,p2,p3,p4,x
109  integer ( kind = 4 ) kp
110 
111  dqwgtc = 0.1d+01 / ( x - c )
112 
113  return
114 
115 end function dqwgtc
116 
117  !----------------------------------------------------------------------------------------
128 function dqwgtf( x, omega, p2, p3, p4, integr )
130  implicit none
131 
132  real ( kind = 8 ) dqwgtf
133  real ( kind = 8 ) dcos,dsin,omega,omx,p2,p3,p4,x
134  integer ( kind = 4 ) integr
135 
136  omx = omega * x
137 
138  if ( integr == 1 ) then
139  dqwgtf = cos( omx )
140  else
141  dqwgtf = sin( omx )
142  end if
143 
144  return
145 
146 end function dqwgtf
147 
148 !----------------------------------------------------------------------------------------
192 subroutine dgtsl ( n, c, d, e, b, info )
194  implicit none
195 
196  integer ( kind = 4 ) n
197 
198  real ( kind = 8 ) b(n)
199  real ( kind = 8 ) c(n)
200  real ( kind = 8 ) d(n)
201  real ( kind = 8 ) e(n)
202  integer ( kind = 4 ) info
203  integer ( kind = 4 ) k
204  real ( kind = 8 ) t
205 
206  info = 0
207  c(1) = d(1)
208 
209  if ( 2 <= n ) then
210 
211  d(1) = e(1)
212  e(1) = 0.0d+00
213  e(n) = 0.0d+00
214 
215  do k = 1, n - 1
216  !
217  ! Find the larger of the two rows.
218  !
219  if ( abs( c(k) ) <= abs( c(k+1) ) ) then
220  !
221  ! Interchange rows.
222  !
223  t = c(k+1)
224  c(k+1) = c(k)
225  c(k) = t
226 
227  t = d(k+1)
228  d(k+1) = d(k)
229  d(k) = t
230 
231  t = e(k+1)
232  e(k+1) = e(k)
233  e(k) = t
234 
235  t = b(k+1)
236  b(k+1) = b(k)
237  b(k) = t
238 
239  end if
240  !
241  ! Zero elements.
242  !
243  if ( c(k) == 0.0d+00 ) then
244  info = k
245  return
246  end if
247 
248  t = -c(k+1) / c(k)
249  c(k+1) = d(k+1) + t * d(k)
250  d(k+1) = e(k+1) + t * e(k)
251  e(k+1) = 0.0d+00
252  b(k+1) = b(k+1) + t * b(k)
253 
254  end do
255 
256  end if
257 
258  if ( c(n) == 0.0d+00 ) then
259  info = n
260  return
261  end if
262  !
263  ! Back solve.
264  !
265  b(n) = b(n) / c(n)
266 
267  if ( 1 < n ) then
268 
269  b(n-1) = ( b(n-1) - d(n-1) * b(n) ) / c(n-1)
270 
271  do k = n-2, 1, -1
272  b(k) = ( b(k) - d(k) * b(k+1) - e(k) * b(k+2) ) / c(k)
273  end do
274 
275  end if
276 
277  return
278 
279 end subroutine dgtsl
280 
281 !----------------------------------------------------------------------------------------
445 subroutine dqage ( f, a, b, epsabs, epsrel, key, limit, result, abserr, &
446  neval, ier, alist, blist, rlist, elist, iord, last )
448  implicit none
449 
450  real ( kind = 8 ) a,abserr,alist,area,area1,area12,area2,a1,a2,b, &
451  blist,b1,b2,defabs,defab1,defab2,elist,epmach, &
452  epsabs,epsrel,errbnd,errmax,error1,error2,erro12,errsum,f, &
453  resabs,result,rlist,uflow
454  integer ( kind = 4 ) ier,iord,iroff1,iroff2,k,key,keyf,last,limit, &
455  maxerr, nrmax, neval
456 
457  dimension alist(limit),blist(limit),elist(limit),iord(limit), &
458  rlist(limit)
459 
460  external f
461 
462  epmach = epsilon( epmach )
463  uflow = tiny( uflow )
464  !
465  ! test on validity of parameters
466  !
467  ier = 0
468  neval = 0
469  last = 0
470  result = 0.0d+00
471  abserr = 0.0d+00
472  alist(1) = a
473  blist(1) = b
474  rlist(1) = 0.0d+00
475  elist(1) = 0.0d+00
476  iord(1) = 0
477 
478  if(epsabs.le.0.0d+00.and. &
479  epsrel.lt. max( 0.5d+02*epmach,0.5d-28)) then
480  ier = 6
481  return
482  end if
483  !
484  ! first approximation to the integral
485  !
486  keyf = key
487  if(key.le.0) keyf = 1
488  if(key.ge.7) keyf = 6
489  neval = 0
490  if(keyf.eq.1) call dqk15(f,a,b,result,abserr,defabs,resabs)
491  if(keyf.eq.2) call dqk21(f,a,b,result,abserr,defabs,resabs)
492  if(keyf.eq.3) call dqk31(f,a,b,result,abserr,defabs,resabs)
493  if(keyf.eq.4) call dqk41(f,a,b,result,abserr,defabs,resabs)
494  if(keyf.eq.5) call dqk51(f,a,b,result,abserr,defabs,resabs)
495  if(keyf.eq.6) call dqk61(f,a,b,result,abserr,defabs,resabs)
496  last = 1
497  rlist(1) = result
498  elist(1) = abserr
499  iord(1) = 1
500  !
501  ! test on accuracy.
502  !
503  errbnd = max( epsabs, epsrel* abs( result ) )
504 
505  if(abserr.le.0.5d+02* epmach * defabs .and. &
506  abserr.gt.errbnd) then
507  ier = 2
508  end if
509 
510  if(limit.eq.1) then
511  ier = 1
512  end if
513 
514  if ( ier .ne. 0 .or. &
515  (abserr .le. errbnd .and. abserr .ne. resabs ) .or. &
516  abserr .eq. 0.0d+00 ) then
517 
518  if(keyf.ne.1) then
519  neval = (10*keyf+1)*(2*neval+1)
520  else
521  neval = 30*neval+15
522  end if
523 
524  return
525 
526  end if
527  !
528  ! initialization
529  !
530  errmax = abserr
531  maxerr = 1
532  area = result
533  errsum = abserr
534  nrmax = 1
535  iroff1 = 0
536  iroff2 = 0
537  !
538  ! main do-loop
539  !
540  do last = 2, limit
541  !
542  ! bisect the subinterval with the largest error estimate.
543  !
544  a1 = alist(maxerr)
545  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
546  a2 = b1
547  b2 = blist(maxerr)
548 
549  if(keyf.eq.1) call dqk15(f,a1,b1,area1,error1,resabs,defab1)
550  if(keyf.eq.2) call dqk21(f,a1,b1,area1,error1,resabs,defab1)
551  if(keyf.eq.3) call dqk31(f,a1,b1,area1,error1,resabs,defab1)
552  if(keyf.eq.4) call dqk41(f,a1,b1,area1,error1,resabs,defab1)
553  if(keyf.eq.5) call dqk51(f,a1,b1,area1,error1,resabs,defab1)
554  if(keyf.eq.6) call dqk61(f,a1,b1,area1,error1,resabs,defab1)
555 
556  if(keyf.eq.1) call dqk15(f,a2,b2,area2,error2,resabs,defab2)
557  if(keyf.eq.2) call dqk21(f,a2,b2,area2,error2,resabs,defab2)
558  if(keyf.eq.3) call dqk31(f,a2,b2,area2,error2,resabs,defab2)
559  if(keyf.eq.4) call dqk41(f,a2,b2,area2,error2,resabs,defab2)
560  if(keyf.eq.5) call dqk51(f,a2,b2,area2,error2,resabs,defab2)
561  if(keyf.eq.6) call dqk61(f,a2,b2,area2,error2,resabs,defab2)
562  !
563  ! improve previous approximations to integral
564  ! and error and test for accuracy.
565  !
566  neval = neval+1
567  area12 = area1+area2
568  erro12 = error1+error2
569  errsum = errsum+erro12-errmax
570  area = area+area12-rlist(maxerr)
571 
572  if ( defab1 .ne. error1 .and. defab2 .ne. error2 ) then
573 
574  if( abs( rlist(maxerr)-area12).le.0.1d-04* abs( area12) &
575  .and. erro12.ge.0.99d+00*errmax) then
576  iroff1 = iroff1+1
577  end if
578 
579  if(last.gt.10.and.erro12.gt.errmax) then
580  iroff2 = iroff2+1
581  end if
582 
583  end if
584 
585  rlist(maxerr) = area1
586  rlist(last) = area2
587  errbnd = max( epsabs,epsrel* abs( area))
588 
589  if ( errbnd .lt. errsum ) then
590  !
591  ! test for roundoff error and eventually set error flag.
592  !
593  if(iroff1.ge.6.or.iroff2.ge.20) then
594  ier = 2
595  end if
596  !
597  ! set error flag in the case that the number of subintervals
598  ! equals limit.
599  !
600  if(last.eq.limit) then
601  ier = 1
602  end if
603  !
604  ! set error flag in the case of bad integrand behaviour
605  ! at a point of the integration range.
606  !
607  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03* &
608  epmach)*( abs( a2)+0.1d+04*uflow)) then
609  ier = 3
610  end if
611 
612  end if
613  !
614  ! append the newly-created intervals to the list.
615  !
616  if(error2.le.error1) then
617  alist(last) = a2
618  blist(maxerr) = b1
619  blist(last) = b2
620  elist(maxerr) = error1
621  elist(last) = error2
622  else
623  alist(maxerr) = a2
624  alist(last) = a1
625  blist(last) = b1
626  rlist(maxerr) = area2
627  rlist(last) = area1
628  elist(maxerr) = error2
629  elist(last) = error1
630  end if
631  !
632  ! call dqpsrt to maintain the descending ordering
633  ! in the list of error estimates and select the subinterval
634  ! with the largest error estimate (to be bisected next).
635  !
636  call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
637 
638  if(ier.ne.0.or.errsum.le.errbnd) then
639  exit
640  end if
641 
642  end do
643  !
644  ! compute final result.
645  !
646  result = 0.0d+00
647  do k=1,last
648  result = result+rlist(k)
649  end do
650  abserr = errsum
651 
652  if(keyf.ne.1) then
653  neval = (10*keyf+1)*(2*neval+1)
654  else
655  neval = 30*neval+15
656  end if
657 
658  return
659 end subroutine dqage
660 
661 !----------------------------------------------------------------------------------------
804 subroutine dqag ( f, a, b, epsabs, epsrel, key, result, abserr, neval, ier, &
805  limit, lenw, last, iwork, work )
807  implicit none
808 
809  integer ( kind = 4 ) lenw
810  integer ( kind = 4 ) limit
811 
812  real ( kind = 8 ) a
813  real ( kind = 8 ) abserr
814  real ( kind = 8 ) b
815  real ( kind = 8 ) epsabs
816  real ( kind = 8 ) epsrel
817  real ( kind = 8 ), external :: f
818  integer ( kind = 4 ) ier
819  integer ( kind = 4 ) iwork(limit)
820  integer ( kind = 4 ) key
821  integer ( kind = 4 ) last
822  integer ( kind = 4 ) lvl
823  integer ( kind = 4 ) l1
824  integer ( kind = 4 ) l2
825  integer ( kind = 4 ) l3
826  integer ( kind = 4 ) neval
827  real ( kind = 8 ) result
828  real ( kind = 8 ) work(lenw)
829  !
830  ! check validity of lenw.
831  !
832  ier = 6
833  neval = 0
834  last = 0
835  result = 0.0d+00
836  abserr = 0.0d+00
837  if(limit.lt.1.or.lenw.lt.limit*4) go to 10
838  !
839  ! prepare call for dqage.
840  !
841  l1 = limit+1
842  l2 = limit+l1
843  l3 = limit+l2
844 
845  call dqage(f,a,b,epsabs,epsrel,key,limit,result,abserr,neval, &
846  ier,work(1),work(l1),work(l2),work(l3),iwork,last)
847  !
848  ! call error handler if necessary.
849  !
850  lvl = 0
851 10 continue
852 
853  if(ier.eq.6) lvl = 1
854  if(ier.ne.0) call xerror('abnormal return from dqag ',26,ier,lvl)
855 
856  return
857  end subroutine dqag
858 
859  !----------------------------------------------------------------------------------------
1053  subroutine dqagie ( f, bound, inf, epsabs, epsrel, limit, result, abserr, &
1054  neval, ier, alist, blist, rlist, elist, iord, last )
1056  implicit none
1057 
1058  real ( kind = 8 ) abseps,abserr,alist,area,area1,area12,area2,a1, &
1059  a2,blist,boun,bound,b1,b2,correc,defabs,defab1,defab2, &
1060  dres,elist,epmach,epsabs,epsrel,erlarg,erlast, &
1061  errbnd,errmax,error1,error2,erro12,errsum,ertest,f,oflow,resabs, &
1062  reseps,result,res3la,rlist,rlist2,small,uflow
1063  integer ( kind = 4 ) id,ier,ierro,inf,iord,iroff1,iroff2, &
1064  iroff3,jupbnd,k,ksgn, &
1065  ktmin,last,limit,maxerr,neval,nres,nrmax,numrl2
1066  logical extrap,noext
1067  dimension alist(limit),blist(limit),elist(limit),iord(limit), &
1068  res3la(3),rlist(limit),rlist2(52)
1069 
1070  external f
1071 
1072  epmach = epsilon( epmach )
1073  !
1074  ! test on validity of parameters
1075  !
1076  ier = 0
1077  neval = 0
1078  last = 0
1079  result = 0.0d+00
1080  abserr = 0.0d+00
1081  alist(1) = 0.0d+00
1082  blist(1) = 0.1d+01
1083  rlist(1) = 0.0d+00
1084  elist(1) = 0.0d+00
1085  iord(1) = 0
1086 
1087  if(epsabs.le.0.0d+00.and.epsrel.lt. max( 0.5d+02*epmach,0.5d-28)) then
1088  ier = 6
1089  end if
1090 
1091  if(ier.eq.6) then
1092  return
1093  end if
1094  !
1095  ! first approximation to the integral
1096  !
1097  ! determine the interval to be mapped onto (0,1).
1098  ! if inf = 2 the integral is computed as i = i1+i2, where
1099  ! i1 = integral of f over (-infinity,0),
1100  ! i2 = integral of f over (0,+infinity).
1101  !
1102  boun = bound
1103  if(inf.eq.2) boun = 0.0d+00
1104  call dqk15i(f,boun,inf,0.0d+00,0.1d+01,result,abserr, &
1105  defabs,resabs)
1106  !
1107  ! test on accuracy
1108  !
1109  last = 1
1110  rlist(1) = result
1111  elist(1) = abserr
1112  iord(1) = 1
1113  dres = abs( result)
1114  errbnd = max( epsabs,epsrel*dres)
1115  if(abserr.le.1.0d+02*epmach*defabs.and.abserr.gt.errbnd) ier = 2
1116  if(limit.eq.1) ier = 1
1117  if(ier.ne.0.or.(abserr.le.errbnd.and.abserr.ne.resabs).or. &
1118  abserr.eq.0.0d+00) go to 130
1119  !
1120  ! initialization
1121  !
1122  uflow = tiny( uflow )
1123  oflow = huge( oflow )
1124  rlist2(1) = result
1125  errmax = abserr
1126  maxerr = 1
1127  area = result
1128  errsum = abserr
1129  abserr = oflow
1130  nrmax = 1
1131  nres = 0
1132  ktmin = 0
1133  numrl2 = 2
1134  extrap = .false.
1135  noext = .false.
1136  ierro = 0
1137  iroff1 = 0
1138  iroff2 = 0
1139  iroff3 = 0
1140  ksgn = -1
1141  if(dres.ge.(0.1d+01-0.5d+02*epmach)*defabs) ksgn = 1
1142  !
1143  ! main do-loop
1144  !
1145  do 90 last = 2,limit
1146  !
1147  ! bisect the subinterval with nrmax-th largest error estimate.
1148  !
1149  a1 = alist(maxerr)
1150  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
1151  a2 = b1
1152  b2 = blist(maxerr)
1153  erlast = errmax
1154  call dqk15i(f,boun,inf,a1,b1,area1,error1,resabs,defab1)
1155  call dqk15i(f,boun,inf,a2,b2,area2,error2,resabs,defab2)
1156  !
1157  ! improve previous approximations to integral
1158  ! and error and test for accuracy.
1159  !
1160  area12 = area1+area2
1161  erro12 = error1+error2
1162  errsum = errsum+erro12-errmax
1163  area = area+area12-rlist(maxerr)
1164  if(defab1.eq.error1.or.defab2.eq.error2)go to 15
1165  if( abs( rlist(maxerr)-area12).gt.0.1d-04* abs( area12) &
1166  .or.erro12.lt.0.99d+00*errmax) go to 10
1167  if(extrap) iroff2 = iroff2+1
1168  if(.not.extrap) iroff1 = iroff1+1
1169 10 if(last.gt.10.and.erro12.gt.errmax) iroff3 = iroff3+1
1170 15 rlist(maxerr) = area1
1171  rlist(last) = area2
1172  errbnd = max( epsabs,epsrel* abs( area))
1173  !
1174  ! test for roundoff error and eventually set error flag.
1175  !
1176  if(iroff1+iroff2.ge.10.or.iroff3.ge.20) ier = 2
1177  if(iroff2.ge.5) ierro = 3
1178  !
1179  ! set error flag in the case that the number of
1180  ! subintervals equals limit.
1181  !
1182  if(last.eq.limit) ier = 1
1183  !
1184  ! set error flag in the case of bad integrand behaviour
1185  ! at some points of the integration range.
1186  !
1187  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03*epmach)* &
1188  ( abs( a2)+0.1d+04*uflow)) then
1189  ier = 4
1190  end if
1191  !
1192  ! append the newly-created intervals to the list.
1193  !
1194  if(error2.gt.error1) go to 20
1195  alist(last) = a2
1196  blist(maxerr) = b1
1197  blist(last) = b2
1198  elist(maxerr) = error1
1199  elist(last) = error2
1200  go to 30
1201 20 continue
1202 
1203  alist(maxerr) = a2
1204  alist(last) = a1
1205  blist(last) = b1
1206  rlist(maxerr) = area2
1207  rlist(last) = area1
1208  elist(maxerr) = error2
1209  elist(last) = error1
1210  !
1211  ! call dqpsrt to maintain the descending ordering
1212  ! in the list of error estimates and select the subinterval
1213  ! with nrmax-th largest error estimate (to be bisected next).
1214  !
1215 30 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
1216  if(errsum.le.errbnd) go to 115
1217  if(ier.ne.0) go to 100
1218  if(last.eq.2) go to 80
1219  if(noext) go to 90
1220  erlarg = erlarg-erlast
1221  if( abs( b1-a1).gt.small) erlarg = erlarg+erro12
1222  if(extrap) go to 40
1223  !
1224  ! test whether the interval to be bisected next is the
1225  ! smallest interval.
1226  !
1227  if( abs( blist(maxerr)-alist(maxerr)).gt.small) go to 90
1228  extrap = .true.
1229  nrmax = 2
1230 40 if(ierro.eq.3.or.erlarg.le.ertest) go to 60
1231  !
1232  ! the smallest interval has the largest error.
1233  ! before bisecting decrease the sum of the errors over the
1234  ! larger intervals (erlarg) and perform extrapolation.
1235  !
1236  id = nrmax
1237  jupbnd = last
1238  if(last.gt.(2+limit/2)) jupbnd = limit+3-last
1239 
1240  do k = id,jupbnd
1241  maxerr = iord(nrmax)
1242  errmax = elist(maxerr)
1243  if( abs( blist(maxerr)-alist(maxerr)).gt.small) go to 90
1244  nrmax = nrmax+1
1245  end do
1246  !
1247  ! perform extrapolation.
1248  !
1249 60 numrl2 = numrl2+1
1250  rlist2(numrl2) = area
1251  call dqelg(numrl2,rlist2,reseps,abseps,res3la,nres)
1252  ktmin = ktmin+1
1253  if(ktmin.gt.5.and.abserr.lt.0.1d-02*errsum) ier = 5
1254  if(abseps.ge.abserr) go to 70
1255  ktmin = 0
1256  abserr = abseps
1257  result = reseps
1258  correc = erlarg
1259  ertest = max( epsabs,epsrel* abs( reseps))
1260  if(abserr.le.ertest) go to 100
1261  !
1262  ! prepare bisection of the smallest interval.
1263  !
1264 70 if(numrl2.eq.1) noext = .true.
1265  if(ier.eq.5) go to 100
1266  maxerr = iord(1)
1267  errmax = elist(maxerr)
1268  nrmax = 1
1269  extrap = .false.
1270  small = small*0.5d+00
1271  erlarg = errsum
1272  go to 90
1273 80 small = 0.375d+00
1274  erlarg = errsum
1275  ertest = errbnd
1276  rlist2(2) = area
1277 90 continue
1278  !
1279  ! set final result and error estimate.
1280  !
1281 100 if(abserr.eq.oflow) go to 115
1282  if((ier+ierro).eq.0) go to 110
1283  if(ierro.eq.3) abserr = abserr+correc
1284  if(ier.eq.0) ier = 3
1285  if(result.ne.0.0d+00.and.area.ne.0.0d+00)go to 105
1286  if(abserr.gt.errsum)go to 115
1287  if(area.eq.0.0d+00) go to 130
1288  go to 110
1289 105 if(abserr/ abs( result).gt.errsum/ abs( area))go to 115
1290  !
1291  ! test on divergence
1292  !
1293 110 continue
1294 
1295  if ( ksgn .eq. (-1) .and. &
1296  max( abs( result), abs( area)) .le. defabs*0.1d-01 ) then
1297  go to 130
1298  end if
1299 
1300  if ( 0.1d-01 .gt. (result/area) .or. &
1301  (result/area) .gt. 0.1d+03 .or. &
1302  errsum .gt. abs( area) ) then
1303  ier = 6
1304  end if
1305 
1306  go to 130
1307  !
1308  ! compute global integral sum.
1309  !
1310 115 result = 0.0d+00
1311  do k = 1,last
1312  result = result+rlist(k)
1313  end do
1314  abserr = errsum
1315 130 continue
1316 
1317  neval = 30*last-15
1318  if(inf.eq.2) neval = 2*neval
1319  if(ier.gt.2) ier=ier-1
1320 
1321  return
1322 end subroutine dqagie
1323 
1324  !----------------------------------------------------------------------------------------
1476 subroutine dqagi ( f, bound, inf, epsabs, epsrel, result, abserr, neval, &
1477  ier,limit,lenw,last,iwork,work)
1479  implicit none
1480 
1481  real ( kind = 8 ) abserr,bound,epsabs,epsrel,f,result,work
1482  integer ( kind = 4 ) ier,inf,iwork,last,lenw,limit,lvl,l1,l2,l3,neval
1483 
1484  dimension iwork(limit),work(lenw)
1485 
1486  external f
1487  !
1488  ! check validity of limit and lenw.
1489  !
1490  ier = 6
1491  neval = 0
1492  last = 0
1493  result = 0.0d+00
1494  abserr = 0.0d+00
1495  if(limit.lt.1.or.lenw.lt.limit*4) go to 10
1496  !
1497  ! prepare call for dqagie.
1498  !
1499  l1 = limit+1
1500  l2 = limit+l1
1501  l3 = limit+l2
1502 
1503  call dqagie(f,bound,inf,epsabs,epsrel,limit,result,abserr, &
1504  neval,ier,work(1),work(l1),work(l2),work(l3),iwork,last)
1505  !
1506  ! call error handler if necessary.
1507  !
1508  lvl = 0
1509 10 if(ier.eq.6) lvl = 1
1510 
1511  if(ier.ne.0) then
1512  call xerror('abnormal return from dqagi',26,ier,lvl)
1513  end if
1514 
1515  return
1516 end subroutine dqagi
1517 
1518  !----------------------------------------------------------------------------------------
1747 subroutine dqagpe(f,a,b,npts2,points,epsabs,epsrel,limit,result, &
1748  abserr,neval,ier,alist,blist,rlist,elist,pts,iord,level,ndin, &
1749  last)
1751  implicit none
1752 
1753  real ( kind = 8 ) a,abseps,abserr,alist,area,area1,area12,area2,a1, &
1754  a2,b,blist,b1,b2,correc,defabs,defab1,defab2, &
1755  dres,elist,epmach,epsabs,epsrel,erlarg,erlast,errbnd, &
1756  errmax,error1,erro12,error2,errsum,ertest,f,oflow,points,pts, &
1757  resa,resabs,reseps,result,res3la,rlist,rlist2,sgn,temp,uflow
1758  integer ( kind = 4 ) i,id,ier,ierro,ind1,ind2,iord,ip1, &
1759  iroff1,iroff2,iroff3,j, &
1760  jlow,jupbnd,k,ksgn,ktmin,last,levcur,level,levmax,limit,maxerr, &
1761  ndin,neval,nint,nintp1,npts,npts2,nres,nrmax,numrl2
1762  logical extrap,noext
1763 
1764  dimension alist(limit),blist(limit),elist(limit),iord(limit), &
1765  level(limit),ndin(npts2),points(npts2),pts(npts2),res3la(3), &
1766  rlist(limit),rlist2(52)
1767 
1768  external f
1769 
1770  epmach = epsilon( epmach )
1771  !
1772  ! test on validity of parameters
1773  !
1774  ier = 0
1775  neval = 0
1776  last = 0
1777  result = 0.0d+00
1778  abserr = 0.0d+00
1779  alist(1) = a
1780  blist(1) = b
1781  rlist(1) = 0.0d+00
1782  elist(1) = 0.0d+00
1783  iord(1) = 0
1784  level(1) = 0
1785  npts = npts2-2
1786  if(npts2.lt.2.or.limit.le.npts.or.(epsabs.le.0.0d+00.and. &
1787  epsrel.lt. max( 0.5d+02*epmach,0.5d-28))) ier = 6
1788 
1789  if(ier.eq.6) then
1790  return
1791  end if
1792  !
1793  ! if any break points are provided, sort them into an
1794  ! ascending sequence.
1795  !
1796  sgn = 1.0d+00
1797  if(a.gt.b) sgn = -1.0d+00
1798  pts(1) = min(a,b)
1799  if(npts.eq.0) go to 15
1800  do i = 1,npts
1801  pts(i+1) = points(i)
1802  end do
1803 15 pts(npts+2) = max( a,b)
1804  nint = npts+1
1805  a1 = pts(1)
1806  if(npts.eq.0) go to 40
1807  nintp1 = nint+1
1808  do i = 1,nint
1809  ip1 = i+1
1810  do j = ip1,nintp1
1811  if(pts(i).gt.pts(j)) then
1812  temp = pts(i)
1813  pts(i) = pts(j)
1814  pts(j) = temp
1815  end if
1816  end do
1817  end do
1818  if(pts(1).ne. min(a,b).or.pts(nintp1).ne. max( a,b)) ier = 6
1819 
1820  if(ier.eq.6) then
1821  return
1822  end if
1823  !
1824  ! compute first integral and error approximations.
1825  !
1826 40 resabs = 0.0d+00
1827 
1828  do i = 1,nint
1829  b1 = pts(i+1)
1830  call dqk21(f,a1,b1,area1,error1,defabs,resa)
1831  abserr = abserr+error1
1832  result = result+area1
1833  ndin(i) = 0
1834  if(error1.eq.resa.and.error1.ne.0.0d+00) ndin(i) = 1
1835  resabs = resabs+defabs
1836  level(i) = 0
1837  elist(i) = error1
1838  alist(i) = a1
1839  blist(i) = b1
1840  rlist(i) = area1
1841  iord(i) = i
1842  a1 = b1
1843  end do
1844 
1845  errsum = 0.0d+00
1846  do i = 1,nint
1847  if(ndin(i).eq.1) elist(i) = abserr
1848  errsum = errsum+elist(i)
1849  end do
1850  !
1851  ! test on accuracy.
1852  !
1853  last = nint
1854  neval = 21*nint
1855  dres = abs( result)
1856  errbnd = max( epsabs,epsrel*dres)
1857  if(abserr.le.0.1d+03*epmach*resabs.and.abserr.gt.errbnd) ier = 2
1858  if(nint.eq.1) go to 80
1859 
1860  do i = 1,npts
1861  jlow = i+1
1862  ind1 = iord(i)
1863  do j = jlow,nint
1864  ind2 = iord(j)
1865  if(elist(ind1).le.elist(ind2)) then
1866  ind1 = ind2
1867  k = j
1868  end if
1869  end do
1870  if(ind1.ne.iord(i)) then
1871  iord(k) = iord(i)
1872  iord(i) = ind1
1873  end if
1874  end do
1875 
1876  if(limit.lt.npts2) ier = 1
1877 80 if(ier.ne.0.or.abserr.le.errbnd) go to 210
1878  !
1879  ! initialization
1880  !
1881  rlist2(1) = result
1882  maxerr = iord(1)
1883  errmax = elist(maxerr)
1884  area = result
1885  nrmax = 1
1886  nres = 0
1887  numrl2 = 1
1888  ktmin = 0
1889  extrap = .false.
1890  noext = .false.
1891  erlarg = errsum
1892  ertest = errbnd
1893  levmax = 1
1894  iroff1 = 0
1895  iroff2 = 0
1896  iroff3 = 0
1897  ierro = 0
1898  uflow = tiny( uflow )
1899  oflow = huge( oflow )
1900  abserr = oflow
1901  ksgn = -1
1902  if(dres.ge.(0.1d+01-0.5d+02*epmach)*resabs) ksgn = 1
1903  !
1904  ! main do-loop
1905  !
1906  do 160 last = npts2,limit
1907  !
1908  ! bisect the subinterval with the nrmax-th largest error estimate.
1909  !
1910  levcur = level(maxerr)+1
1911  a1 = alist(maxerr)
1912  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
1913  a2 = b1
1914  b2 = blist(maxerr)
1915  erlast = errmax
1916  call dqk21(f,a1,b1,area1,error1,resa,defab1)
1917  call dqk21(f,a2,b2,area2,error2,resa,defab2)
1918  !
1919  ! improve previous approximations to integral
1920  ! and error and test for accuracy.
1921  !
1922  neval = neval+42
1923  area12 = area1+area2
1924  erro12 = error1+error2
1925  errsum = errsum+erro12-errmax
1926  area = area+area12-rlist(maxerr)
1927  if(defab1.eq.error1.or.defab2.eq.error2) go to 95
1928  if( abs( rlist(maxerr)-area12).gt.0.1d-04* abs( area12) &
1929  .or.erro12.lt.0.99d+00*errmax) go to 90
1930  if(extrap) iroff2 = iroff2+1
1931  if(.not.extrap) iroff1 = iroff1+1
1932 90 if(last.gt.10.and.erro12.gt.errmax) iroff3 = iroff3+1
1933 95 level(maxerr) = levcur
1934  level(last) = levcur
1935  rlist(maxerr) = area1
1936  rlist(last) = area2
1937  errbnd = max( epsabs,epsrel* abs( area))
1938  !
1939  ! test for roundoff error and eventually set error flag.
1940  !
1941  if(iroff1+iroff2.ge.10.or.iroff3.ge.20) ier = 2
1942  if(iroff2.ge.5) ierro = 3
1943  !
1944  ! set error flag in the case that the number of
1945  ! subintervals equals limit.
1946  !
1947  if(last.eq.limit) ier = 1
1948  !
1949  ! set error flag in the case of bad integrand behaviour
1950  ! at a point of the integration range
1951  !
1952  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03*epmach)* &
1953  ( abs( a2)+0.1d+04*uflow)) ier = 4
1954  !
1955  ! append the newly-created intervals to the list.
1956  !
1957  if(error2.gt.error1) go to 100
1958  alist(last) = a2
1959  blist(maxerr) = b1
1960  blist(last) = b2
1961  elist(maxerr) = error1
1962  elist(last) = error2
1963  go to 110
1964 100 alist(maxerr) = a2
1965  alist(last) = a1
1966  blist(last) = b1
1967  rlist(maxerr) = area2
1968  rlist(last) = area1
1969  elist(maxerr) = error2
1970  elist(last) = error1
1971  !
1972  ! call dqpsrt to maintain the descending ordering
1973  ! in the list of error estimates and select the subinterval
1974  ! with nrmax-th largest error estimate (to be bisected next).
1975  !
1976 110 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
1977  if(errsum.le.errbnd) go to 190
1978  if(ier.ne.0) go to 170
1979  if(noext) go to 160
1980  erlarg = erlarg-erlast
1981  if(levcur+1.le.levmax) erlarg = erlarg+erro12
1982  if(extrap) go to 120
1983  !
1984  ! test whether the interval to be bisected next is the
1985  ! smallest interval.
1986  !
1987  if(level(maxerr)+1.le.levmax) go to 160
1988  extrap = .true.
1989  nrmax = 2
1990 120 if(ierro.eq.3.or.erlarg.le.ertest) go to 140
1991  !
1992  ! the smallest interval has the largest error.
1993  ! before bisecting decrease the sum of the errors over
1994  ! the larger intervals (erlarg) and perform extrapolation.
1995  !
1996  id = nrmax
1997  jupbnd = last
1998  if(last.gt.(2+limit/2)) jupbnd = limit+3-last
1999 
2000  do k = id,jupbnd
2001  maxerr = iord(nrmax)
2002  errmax = elist(maxerr)
2003  if(level(maxerr)+1.le.levmax) go to 160
2004  nrmax = nrmax+1
2005  end do
2006  !
2007  ! perform extrapolation.
2008  !
2009 140 numrl2 = numrl2+1
2010  rlist2(numrl2) = area
2011  if(numrl2.le.2) go to 155
2012  call dqelg(numrl2,rlist2,reseps,abseps,res3la,nres)
2013  ktmin = ktmin+1
2014  if(ktmin.gt.5.and.abserr.lt.0.1d-02*errsum) ier = 5
2015  if(abseps.ge.abserr) go to 150
2016  ktmin = 0
2017  abserr = abseps
2018  result = reseps
2019  correc = erlarg
2020  ertest = max( epsabs,epsrel* abs( reseps))
2021  if(abserr.lt.ertest) go to 170
2022  !
2023  ! prepare bisection of the smallest interval.
2024  !
2025 150 if(numrl2.eq.1) noext = .true.
2026  if(ier.ge.5) go to 170
2027 155 maxerr = iord(1)
2028  errmax = elist(maxerr)
2029  nrmax = 1
2030  extrap = .false.
2031  levmax = levmax+1
2032  erlarg = errsum
2033 160 continue
2034 !
2035 ! set the final result.
2036 !
2037 170 continue
2038 
2039  if(abserr.eq.oflow) go to 190
2040  if((ier+ierro).eq.0) go to 180
2041  if(ierro.eq.3) abserr = abserr+correc
2042  if(ier.eq.0) ier = 3
2043  if(result.ne.0.0d+00.and.area.ne.0.0d+00)go to 175
2044  if(abserr.gt.errsum)go to 190
2045  if(area.eq.0.0d+00) go to 210
2046  go to 180
2047 175 if(abserr/ abs( result).gt.errsum/ abs( area))go to 190
2048  !
2049  ! test on divergence.
2050  !
2051 180 if(ksgn.eq.(-1).and. max( abs( result), abs( area)).le. &
2052  resabs*0.1d-01) go to 210
2053  if(0.1d-01.gt.(result/area).or.(result/area).gt.0.1d+03.or. &
2054  errsum.gt. abs( area)) ier = 6
2055  go to 210
2056  !
2057  ! compute global integral sum.
2058  !
2059 190 result = 0.0d+00
2060  do k = 1,last
2061  result = result+rlist(k)
2062  end do
2063 
2064  abserr = errsum
2065 210 if(ier.gt.2) ier = ier-1
2066  result = result*sgn
2067 
2068  return
2069 end subroutine dqagpe
2070 
2071  !----------------------------------------------------------------------------------------
2250 subroutine dqagp ( f, a, b, npts2, points, epsabs, epsrel, result, abserr, &
2251  neval, ier, leniw, lenw, last, iwork, work )
2253  implicit none
2254 
2255  real ( kind = 8 ) a,abserr,b,epsabs,epsrel,f,points,result,work
2256  integer ( kind = 4 ) ier,iwork,last,leniw,lenw,limit,lvl,l1,l2,l3, &
2257  l4,neval,npts2
2258 
2259  dimension iwork(leniw),points(npts2),work(lenw)
2260 
2261  external f
2262  !
2263  ! check validity of limit and lenw.
2264  !
2265  ier = 6
2266  neval = 0
2267  last = 0
2268  result = 0.0d+00
2269  abserr = 0.0d+00
2270  if(leniw.lt.(3*npts2-2).or.lenw.lt.(leniw*2-npts2).or.npts2.lt.2) &
2271  go to 10
2272  !
2273  ! prepare call for dqagpe.
2274  !
2275  limit = (leniw-npts2)/2
2276  l1 = limit+1
2277  l2 = limit+l1
2278  l3 = limit+l2
2279  l4 = limit+l3
2280 
2281  call dqagpe(f,a,b,npts2,points,epsabs,epsrel,limit,result,abserr, &
2282  neval,ier,work(1),work(l1),work(l2),work(l3),work(l4), &
2283  iwork(1),iwork(l1),iwork(l2),last)
2284  !
2285  ! call error handler if necessary.
2286  !
2287  lvl = 0
2288 10 if(ier.eq.6) lvl = 1
2289 
2290  if(ier.ne.0) then
2291  call xerror('abnormal return from dqagp',26,ier,lvl)
2292  end if
2293 
2294  return
2295 end subroutine dqagp
2296 
2297  !----------------------------------------------------------------------------------------
2490 subroutine dqagse(f,a,b,epsabs,epsrel,limit,result,abserr,neval, &
2491  ier,alist,blist,rlist,elist,iord,last)
2493  implicit none
2494 
2495  real ( kind = 8 ) a,abseps,abserr,alist,area,area1,area12,area2,a1, &
2496  a2,b,blist,b1,b2,correc,defabs,defab1,defab2, &
2497  dres,elist,epmach,epsabs,epsrel,erlarg,erlast,errbnd,errmax, &
2498  error1,error2,erro12,errsum,ertest,f,oflow,resabs,reseps,result, &
2499  res3la,rlist,rlist2,small,uflow
2500  integer ( kind = 4 ) id,ier,ierro,iord,iroff1,iroff2,iroff3,jupbnd, &
2501  k,ksgn,ktmin,last,limit,maxerr,neval,nres,nrmax,numrl2
2502  logical extrap,noext
2503  dimension alist(limit),blist(limit),elist(limit),iord(limit), &
2504  res3la(3),rlist(limit),rlist2(52)
2505 
2506  external f
2507 
2508  epmach = epsilon( epmach )
2509  !
2510  ! test on validity of parameters
2511  !
2512  ier = 0
2513  neval = 0
2514  last = 0
2515  result = 0.0d+00
2516  abserr = 0.0d+00
2517  alist(1) = a
2518  blist(1) = b
2519  rlist(1) = 0.0d+00
2520  elist(1) = 0.0d+00
2521 
2522  if(epsabs.le.0.0d+00.and.epsrel.lt. max( 0.5d+02*epmach,0.5d-28)) then
2523  ier = 6
2524  return
2525  end if
2526  !
2527  ! first approximation to the integral
2528  !
2529  uflow = tiny( uflow )
2530  oflow = huge( oflow )
2531  ierro = 0
2532  call dqk21(f,a,b,result,abserr,defabs,resabs)
2533  !
2534  ! test on accuracy.
2535  !
2536  dres = abs( result)
2537  errbnd = max( epsabs,epsrel*dres)
2538  last = 1
2539  rlist(1) = result
2540  elist(1) = abserr
2541  iord(1) = 1
2542  if(abserr.le.1.0d+02*epmach*defabs.and.abserr.gt.errbnd) ier = 2
2543  if(limit.eq.1) ier = 1
2544  if(ier.ne.0.or.(abserr.le.errbnd.and.abserr.ne.resabs).or. &
2545  abserr.eq.0.0d+00) go to 140
2546  !
2547  ! initialization
2548  !
2549  rlist2(1) = result
2550  errmax = abserr
2551  maxerr = 1
2552  area = result
2553  errsum = abserr
2554  abserr = oflow
2555  nrmax = 1
2556  nres = 0
2557  numrl2 = 2
2558  ktmin = 0
2559  extrap = .false.
2560  noext = .false.
2561  iroff1 = 0
2562  iroff2 = 0
2563  iroff3 = 0
2564  ksgn = -1
2565  if(dres.ge.(0.1d+01-0.5d+02*epmach)*defabs) ksgn = 1
2566  !
2567  ! main do-loop
2568  !
2569  do 90 last = 2,limit
2570  !
2571  ! bisect the subinterval with the nrmax-th largest error estimate.
2572  !
2573  a1 = alist(maxerr)
2574  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
2575  a2 = b1
2576  b2 = blist(maxerr)
2577  erlast = errmax
2578  call dqk21(f,a1,b1,area1,error1,resabs,defab1)
2579  call dqk21(f,a2,b2,area2,error2,resabs,defab2)
2580  !
2581  ! improve previous approximations to integral
2582  ! and error and test for accuracy.
2583  !
2584  area12 = area1+area2
2585  erro12 = error1+error2
2586  errsum = errsum+erro12-errmax
2587  area = area+area12-rlist(maxerr)
2588  if(defab1.eq.error1.or.defab2.eq.error2) go to 15
2589  if( abs( rlist(maxerr)-area12).gt.0.1d-04* abs( area12) &
2590  .or.erro12.lt.0.99d+00*errmax) go to 10
2591  if(extrap) iroff2 = iroff2+1
2592  if(.not.extrap) iroff1 = iroff1+1
2593 10 if(last.gt.10.and.erro12.gt.errmax) iroff3 = iroff3+1
2594 15 rlist(maxerr) = area1
2595  rlist(last) = area2
2596  errbnd = max( epsabs,epsrel* abs( area))
2597  !
2598  ! test for roundoff error and eventually set error flag.
2599  !
2600  if(iroff1+iroff2.ge.10.or.iroff3.ge.20) ier = 2
2601  if(iroff2.ge.5) ierro = 3
2602  !
2603  ! set error flag in the case that the number of subintervals
2604  ! equals limit.
2605  !
2606  if(last.eq.limit) ier = 1
2607  !
2608  ! set error flag in the case of bad integrand behaviour
2609  ! at a point of the integration range.
2610  !
2611  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03*epmach)* &
2612  ( abs( a2)+0.1d+04*uflow)) ier = 4
2613  !
2614  ! append the newly-created intervals to the list.
2615  !
2616  if(error2.gt.error1) go to 20
2617  alist(last) = a2
2618  blist(maxerr) = b1
2619  blist(last) = b2
2620  elist(maxerr) = error1
2621  elist(last) = error2
2622  go to 30
2623 20 alist(maxerr) = a2
2624  alist(last) = a1
2625  blist(last) = b1
2626  rlist(maxerr) = area2
2627  rlist(last) = area1
2628  elist(maxerr) = error2
2629  elist(last) = error1
2630  !
2631  ! call dqpsrt to maintain the descending ordering
2632  ! in the list of error estimates and select the subinterval
2633  ! with nrmax-th largest error estimate (to be bisected next).
2634  !
2635 30 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
2636  if(errsum.le.errbnd) go to 115
2637  if(ier.ne.0) go to 100
2638  if(last.eq.2) go to 80
2639  if(noext) go to 90
2640  erlarg = erlarg-erlast
2641  if( abs( b1-a1).gt.small) erlarg = erlarg+erro12
2642  if(extrap) go to 40
2643  !
2644  ! test whether the interval to be bisected next is the
2645  ! smallest interval.
2646  !
2647  if( abs( blist(maxerr)-alist(maxerr)).gt.small) go to 90
2648  extrap = .true.
2649  nrmax = 2
2650 40 if(ierro.eq.3.or.erlarg.le.ertest) go to 60
2651  !
2652  ! the smallest interval has the largest error.
2653  ! before bisecting decrease the sum of the errors over the
2654  ! larger intervals (erlarg) and perform extrapolation.
2655  !
2656  id = nrmax
2657  jupbnd = last
2658  if(last.gt.(2+limit/2)) jupbnd = limit+3-last
2659  do k = id,jupbnd
2660  maxerr = iord(nrmax)
2661  errmax = elist(maxerr)
2662  if( abs( blist(maxerr)-alist(maxerr)).gt.small) go to 90
2663  nrmax = nrmax+1
2664  end do
2665  !
2666  ! perform extrapolation.
2667  !
2668 60 numrl2 = numrl2+1
2669  rlist2(numrl2) = area
2670  call dqelg(numrl2,rlist2,reseps,abseps,res3la,nres)
2671  ktmin = ktmin+1
2672  if(ktmin.gt.5.and.abserr.lt.0.1d-02*errsum) ier = 5
2673  if(abseps.ge.abserr) go to 70
2674  ktmin = 0
2675  abserr = abseps
2676  result = reseps
2677  correc = erlarg
2678  ertest = max( epsabs,epsrel* abs( reseps))
2679  if(abserr.le.ertest) go to 100
2680  !
2681  ! prepare bisection of the smallest interval.
2682  !
2683 70 if(numrl2.eq.1) noext = .true.
2684  if(ier.eq.5) go to 100
2685  maxerr = iord(1)
2686  errmax = elist(maxerr)
2687  nrmax = 1
2688  extrap = .false.
2689  small = small*0.5d+00
2690  erlarg = errsum
2691  go to 90
2692 80 small = abs( b-a)*0.375d+00
2693  erlarg = errsum
2694  ertest = errbnd
2695  rlist2(2) = area
2696 90 continue
2697  !
2698  ! set final result and error estimate.
2699  !
2700 100 if(abserr.eq.oflow) go to 115
2701  if(ier+ierro.eq.0) go to 110
2702  if(ierro.eq.3) abserr = abserr+correc
2703  if(ier.eq.0) ier = 3
2704  if(result.ne.0.0d+00.and.area.ne.0.0d+00) go to 105
2705  if(abserr.gt.errsum) go to 115
2706  if(area.eq.0.0d+00) go to 130
2707  go to 110
2708 105 if(abserr/ abs( result).gt.errsum/ abs( area)) go to 115
2709  !
2710  ! test on divergence.
2711  !
2712 110 if(ksgn.eq.(-1).and. max( abs( result), abs( area)).le. &
2713  defabs*0.1d-01) go to 130
2714  if(0.1d-01.gt.(result/area).or.(result/area).gt.0.1d+03 &
2715  .or.errsum.gt. abs( area)) ier = 6
2716  go to 130
2717  !
2718  ! compute global integral sum.
2719  !
2720 115 result = 0.0d+00
2721  do k = 1,last
2722  result = result+rlist(k)
2723  end do
2724  abserr = errsum
2725 130 if(ier.gt.2) ier = ier-1
2726 140 neval = 42*last-21
2727 
2728  return
2729 end subroutine dqagse
2730 
2731  !----------------------------------------------------------------------------------------
2876 subroutine dqags ( f, a, b, epsabs, epsrel, result, abserr, neval, ier, &
2877  limit, lenw, last, iwork, work )
2879  implicit none
2880 
2881  real ( kind = 8 ) a,abserr,b,epsabs,epsrel,f,result,work
2882  integer ( kind = 4 ) ier,iwork,last,lenw,limit,lvl,l1,l2,l3,neval
2883  dimension iwork(limit),work(lenw)
2884 
2885  external f
2886  !
2887  ! check validity of limit and lenw.
2888  !
2889  ier = 6
2890  neval = 0
2891  last = 0
2892  result = 0.0d+00
2893  abserr = 0.0d+00
2894  if(limit.lt.1.or.lenw.lt.limit*4) go to 10
2895  !
2896  ! prepare call for dqagse.
2897  !
2898  l1 = limit+1
2899  l2 = limit+l1
2900  l3 = limit+l2
2901 
2902  call dqagse(f,a,b,epsabs,epsrel,limit,result,abserr,neval, &
2903  ier,work(1),work(l1),work(l2),work(l3),iwork,last)
2904  !
2905  ! call error handler if necessary.
2906  !
2907  lvl = 0
2908 10 if(ier.eq.6) lvl = 1
2909  if(ier.ne.0) call xerror('abnormal return from dqags',26,ier,lvl)
2910 
2911  return
2912 end subroutine dqags
2913 
2914  !----------------------------------------------------------------------------------------
3071 subroutine dqawce(f,a,b,c,epsabs,epsrel,limit,result,abserr,neval, &
3072  ier,alist,blist,rlist,elist,iord,last)
3074  implicit none
3075 
3076  real ( kind = 8 ) a,aa,abserr,alist,area,area1,area12,area2,a1,a2, &
3077  b,bb,blist,b1,b2,c,elist,epmach,epsabs,epsrel, &
3078  errbnd,errmax,error1,erro12,error2,errsum,f,result,rlist,uflow
3079  integer ( kind = 4 ) ier,iord,iroff1,iroff2,k,krule,last,limit,&
3080  maxerr, nev, &
3081  neval,nrmax
3082  dimension alist(limit),blist(limit),rlist(limit),elist(limit), &
3083  iord(limit)
3084 
3085  external f
3086 
3087  epmach = epsilon( epmach )
3088  uflow = tiny( uflow )
3089  !
3090  ! test on validity of parameters
3091  !
3092  ier = 6
3093  neval = 0
3094  last = 0
3095  alist(1) = a
3096  blist(1) = b
3097  rlist(1) = 0.0d+00
3098  elist(1) = 0.0d+00
3099  iord(1) = 0
3100  result = 0.0d+00
3101  abserr = 0.0d+00
3102 
3103  if ( c.eq.a .or. &
3104  c.eq.b .or. &
3105  (epsabs.le.0.0d+00 .and. epsrel.lt. max( 0.5d+02*epmach,0.5d-28)) ) then
3106  ier = 6
3107  return
3108  end if
3109  !
3110  ! first approximation to the integral
3111  !
3112  if ( a <= b ) then
3113  aa=a
3114  bb=b
3115  else
3116  aa=b
3117  bb=a
3118  end if
3119 
3120  ier=0
3121  krule = 1
3122  call dqc25c(f,aa,bb,c,result,abserr,krule,neval)
3123  last = 1
3124  rlist(1) = result
3125  elist(1) = abserr
3126  iord(1) = 1
3127  alist(1) = a
3128  blist(1) = b
3129  !
3130  ! test on accuracy
3131  !
3132  errbnd = max( epsabs,epsrel* abs( result))
3133  if(limit.eq.1) ier = 1
3134 
3135  if(abserr.lt. min(0.1d-01* abs( result),errbnd) &
3136  .or.ier.eq.1) go to 70
3137  !
3138  ! initialization
3139  !
3140  alist(1) = aa
3141  blist(1) = bb
3142  rlist(1) = result
3143  errmax = abserr
3144  maxerr = 1
3145  area = result
3146  errsum = abserr
3147  nrmax = 1
3148  iroff1 = 0
3149  iroff2 = 0
3150  !
3151  ! main do-loop
3152  !
3153  do 40 last = 2,limit
3154  !
3155  ! bisect the subinterval with nrmax-th largest error estimate.
3156  !
3157  a1 = alist(maxerr)
3158  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
3159  b2 = blist(maxerr)
3160  if(c.le.b1.and.c.gt.a1) b1 = 0.5d+00*(c+b2)
3161  if(c.gt.b1.and.c.lt.b2) b1 = 0.5d+00*(a1+c)
3162  a2 = b1
3163  krule = 2
3164  call dqc25c(f,a1,b1,c,area1,error1,krule,nev)
3165  neval = neval+nev
3166  call dqc25c(f,a2,b2,c,area2,error2,krule,nev)
3167  neval = neval+nev
3168  !
3169  ! improve previous approximations to integral
3170  ! and error and test for accuracy.
3171  !
3172  area12 = area1+area2
3173  erro12 = error1+error2
3174  errsum = errsum+erro12-errmax
3175  area = area+area12-rlist(maxerr)
3176  if( abs( rlist(maxerr)-area12).lt.0.1d-04* abs( area12) &
3177  .and.erro12.ge.0.99d+00*errmax.and.krule.eq.0) &
3178  iroff1 = iroff1+1
3179  if(last.gt.10.and.erro12.gt.errmax.and.krule.eq.0) &
3180  iroff2 = iroff2+1
3181  rlist(maxerr) = area1
3182  rlist(last) = area2
3183  errbnd = max( epsabs,epsrel* abs( area))
3184  if(errsum.le.errbnd) go to 15
3185  !
3186  ! test for roundoff error and eventually set error flag.
3187  !
3188  if(iroff1.ge.6.and.iroff2.gt.20) ier = 2
3189  !
3190  ! set error flag in the case that number of interval bisections exceeds limit.
3191  !
3192  if(last.eq.limit) ier = 1
3193  !
3194  ! set error flag in the case of bad integrand behaviour
3195  ! at a point of the integration range.
3196  !
3197  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03*epmach) &
3198  *( abs( a2)+0.1d+04*uflow)) ier = 3
3199  !
3200  ! append the newly-created intervals to the list.
3201  !
3202 15 continue
3203 
3204  if ( error2 .le. error1 ) then
3205  alist(last) = a2
3206  blist(maxerr) = b1
3207  blist(last) = b2
3208  elist(maxerr) = error1
3209  elist(last) = error2
3210  else
3211  alist(maxerr) = a2
3212  alist(last) = a1
3213  blist(last) = b1
3214  rlist(maxerr) = area2
3215  rlist(last) = area1
3216  elist(maxerr) = error2
3217  elist(last) = error1
3218  end if
3219  !
3220  ! call dqpsrt to maintain the descending ordering
3221  ! in the list of error estimates and select the subinterval
3222  ! with nrmax-th largest error estimate (to be bisected next).
3223  !
3224  call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
3225 
3226  if(ier.ne.0.or.errsum.le.errbnd) go to 50
3227 
3228 40 continue
3229  !
3230  ! compute final result.
3231  !
3232 50 continue
3233 
3234  result = 0.0d+00
3235  do k=1,last
3236  result = result+rlist(k)
3237  end do
3238 
3239  abserr = errsum
3240 70 if (aa.eq.b) result=-result
3241 
3242  return
3243  end subroutine dqawce
3244 
3245  !----------------------------------------------------------------------------------------
3382  subroutine dqawc ( f, a, b, c, epsabs, epsrel, result, abserr, neval, ier, &
3383  limit, lenw, last, iwork, work )
3385  implicit none
3386 
3387  real ( kind = 8 ) a,abserr,b,c,epsabs,epsrel,f,result,work
3388  integer ( kind = 4 ) ier,iwork,last,lenw,limit,lvl,l1,l2,l3,neval
3389  dimension iwork(limit),work(lenw)
3390 
3391  external f
3392  !
3393  ! check validity of limit and lenw.
3394  !
3395  ier = 6
3396  neval = 0
3397  last = 0
3398  result = 0.0d+00
3399  abserr = 0.0d+00
3400  if(limit.lt.1.or.lenw.lt.limit*4) go to 10
3401  !
3402  ! prepare call for dqawce.
3403  !
3404  l1 = limit+1
3405  l2 = limit+l1
3406  l3 = limit+l2
3407  call dqawce(f,a,b,c,epsabs,epsrel,limit,result,abserr,neval,ier, &
3408  work(1),work(l1),work(l2),work(l3),iwork,last)
3409  !
3410  ! call error handler if necessary.
3411  !
3412  lvl = 0
3413 10 if(ier.eq.6) lvl = 1
3414 
3415  if(ier.ne.0) then
3416  call xerror('abnormal return from dqawc',26,ier,lvl)
3417  end if
3418 
3419  return
3420  end subroutine dqawc
3421 
3422  !----------------------------------------------------------------------------------------
3632  subroutine dqawfe(f,a,omega,integr,epsabs,limlst,limit,maxp1, &
3633  result,abserr,neval,ier,rslst,erlst,ierlst,lst,alist,blist, &
3634  rlist,elist,iord,nnlog,chebmo)
3636  implicit none
3637 
3638  real ( kind = 8 ) a,abseps,abserr,alist,blist,chebmo,correc,cycle, &
3639  c1,c2,dl,dla,drl,elist,erlst,ep,eps,epsa, &
3640  epsabs,errsum,f,fact,omega,p,pi,p1,psum,reseps,result,res3la, &
3641  rlist,rslst,uflow
3642  integer ( kind = 4 ) ier,ierlst,integr,iord,ktmin,l,last,lst,limit
3643  integer ( kind = 4 ) limlst
3644  integer ( kind = 4 ) ll
3645  integer ( kind = 4 ) maxp1,momcom,nev,neval,nnlog,nres,numrl2
3646 
3647  dimension alist(limit),blist(limit),chebmo(maxp1,25),elist(limit), &
3648  erlst(limlst),ierlst(limlst),iord(limit),nnlog(limit),psum(52), &
3649  res3la(3),rlist(limit),rslst(limlst)
3650 
3651  external f
3652 
3653  data p / 0.9d+00 /
3654  data pi / 3.14159265358979323846264338327950d+00 /
3655  !
3656  ! test on validity of parameters
3657  !
3658  result = 0.0d+00
3659  abserr = 0.0d+00
3660  neval = 0
3661  lst = 0
3662  ier = 0
3663 
3664  if((integr.ne.1.and.integr.ne.2).or.epsabs.le.0.0d+00.or. &
3665  limlst.lt.3) then
3666  ier = 6
3667  return
3668  end if
3669 
3670  if(omega.ne.0.0d+00) go to 10
3671  !
3672  ! integration by dqagie if omega is zero
3673  !
3674  if(integr.eq.1) then
3675  call dqagie(f,0.0d+00,1,epsabs,0.0d+00,limit, &
3676  result,abserr,neval,ier,alist,blist,rlist,elist,iord,last)
3677  end if
3678 
3679  rslst(1) = result
3680  erlst(1) = abserr
3681  ierlst(1) = ier
3682  lst = 1
3683  go to 999
3684  !
3685  ! initializations
3686  !
3687 10 l = abs( omega)
3688  dl = 2*l+1
3689  cycle = dl*pi/ abs( omega)
3690  ier = 0
3691  ktmin = 0
3692  neval = 0
3693  numrl2 = 0
3694  nres = 0
3695  c1 = a
3696  c2 = cycle+a
3697  p1 = 0.1d+01-p
3698  uflow = tiny( uflow )
3699  eps = epsabs
3700  if(epsabs.gt.uflow/p1) eps = epsabs*p1
3701  ep = eps
3702  fact = 0.1d+01
3703  correc = 0.0d+00
3704  abserr = 0.0d+00
3705  errsum = 0.0d+00
3706  !
3707  ! main do-loop
3708  !
3709  do lst = 1,limlst
3710  !
3711  ! integrate over current subinterval.
3712  !
3713  dla = lst
3714  epsa = eps*fact
3715  call dqawoe(f,c1,c2,omega,integr,epsa,0.0d+00,limit,lst,maxp1, &
3716  rslst(lst),erlst(lst),nev,ierlst(lst),last,alist,blist,rlist, &
3717  elist,iord,nnlog,momcom,chebmo)
3718  neval = neval+nev
3719  fact = fact*p
3720  errsum = errsum+erlst(lst)
3721  drl = 0.5d+02* abs( rslst(lst))
3722  !
3723  ! test on accuracy with partial sum
3724  !
3725  if((errsum+drl).le.epsabs.and.lst.ge.6) go to 80
3726  correc = max( correc,erlst(lst))
3727  if(ierlst(lst).ne.0) eps = max( ep,correc*p1)
3728  if(ierlst(lst).ne.0) ier = 7
3729  if(ier.eq.7.and.(errsum+drl).le.correc*0.1d+02.and. &
3730  lst.gt.5) go to 80
3731  numrl2 = numrl2+1
3732  if(lst.gt.1) go to 20
3733  psum(1) = rslst(1)
3734  go to 40
3735 20 psum(numrl2) = psum(ll)+rslst(lst)
3736  if(lst.eq.2) go to 40
3737  !
3738  ! test on maximum number of subintervals
3739  !
3740  if(lst.eq.limlst) ier = 1
3741  !
3742  ! perform new extrapolation
3743  !
3744  call dqelg(numrl2,psum,reseps,abseps,res3la,nres)
3745  !
3746  ! test whether extrapolated result is influenced by roundoff
3747  !
3748  ktmin = ktmin+1
3749  if(ktmin.ge.15.and.abserr.le.0.1d-02*(errsum+drl)) ier = 4
3750  if(abseps.gt.abserr.and.lst.ne.3) go to 30
3751  abserr = abseps
3752  result = reseps
3753  ktmin = 0
3754  !
3755  ! if ier is not 0, check whether direct result (partial sum)
3756  ! or extrapolated result yields the best integral
3757  ! approximation
3758  !
3759  if((abserr+0.1d+02*correc).le.epsabs.or. &
3760  (abserr.le.epsabs.and.0.1d+02*correc.ge.epsabs)) go to 60
3761 30 if(ier.ne.0.and.ier.ne.7) go to 60
3762 40 ll = numrl2
3763  c1 = c2
3764  c2 = c2+cycle
3765  end do
3766  !
3767  ! set final result and error estimate
3768  !
3769 60 abserr = abserr+0.1d+02*correc
3770  if(ier.eq.0) go to 999
3771  if(result.ne.0.0d+00.and.psum(numrl2).ne.0.0d+00) go to 70
3772  if(abserr.gt.errsum) go to 80
3773  if(psum(numrl2).eq.0.0d+00) go to 999
3774 70 if(abserr/ abs( result).gt.(errsum+drl)/ abs( psum(numrl2))) &
3775  go to 80
3776  if(ier.ge.1.and.ier.ne.7) abserr = abserr+drl
3777  go to 999
3778 80 result = psum(numrl2)
3779  abserr = errsum+drl
3780 999 continue
3781 
3782  return
3783 end subroutine dqawfe
3784 
3785  !----------------------------------------------------------------------------------------
3967 subroutine dqawf ( f, a, omega, integr, epsabs, result, abserr, neval, ier, &
3968  limlst, lst, leniw, maxp1, lenw, iwork, work )
3970  implicit none
3971 
3972  integer ( kind = 4 ) leniw
3973  integer ( kind = 4 ) lenw
3974 
3975  real ( kind = 8 ) a
3976  real ( kind = 8 ) abserr
3977  real ( kind = 8 ) epsabs
3978  real ( kind = 8 ), external :: f
3979  integer ( kind = 4 ) ier
3980  integer ( kind = 4 ) integr
3981  integer ( kind = 4 ) iwork(leniw)
3982  integer ( kind = 4 ) last
3983  integer ( kind = 4 ) limit
3984  integer ( kind = 4 ) limlst
3985  integer ( kind = 4 ) ll2
3986  integer ( kind = 4 ) lst
3987  integer ( kind = 4 ) lvl
3988  integer ( kind = 4 ) l1
3989  integer ( kind = 4 ) l2
3990  integer ( kind = 4 ) l3
3991  integer ( kind = 4 ) l4
3992  integer ( kind = 4 ) l5
3993  integer ( kind = 4 ) l6
3994  integer ( kind = 4 ) maxp1
3995  integer ( kind = 4 ) neval
3996  real ( kind = 8 ) omega
3997  real ( kind = 8 ) result
3998  real ( kind = 8 ) work(lenw)
3999  !
4000  ! check validity of limlst, leniw, maxp1 and lenw.
4001  !
4002  ier = 6
4003  neval = 0
4004  last = 0
4005  result = 0.0d+00
4006  abserr = 0.0d+00
4007  if(limlst.lt.3.or.leniw.lt.(limlst+2).or.maxp1.lt.1.or.lenw.lt. &
4008  (leniw*2+maxp1*25)) go to 10
4009  !
4010  ! prepare call for dqawfe
4011  !
4012  limit = (leniw-limlst)/2
4013  l1 = limlst+1
4014  l2 = limlst+l1
4015  l3 = limit+l2
4016  l4 = limit+l3
4017  l5 = limit+l4
4018  l6 = limit+l5
4019  ll2 = limit+l1
4020  call dqawfe(f,a,omega,integr,epsabs,limlst,limit,maxp1,result, &
4021  abserr,neval,ier,work(1),work(l1),iwork(1),lst,work(l2), &
4022  work(l3),work(l4),work(l5),iwork(l1),iwork(ll2),work(l6))
4023  !
4024  ! call error handler if necessary
4025  !
4026  lvl = 0
4027 10 continue
4028 
4029  if(ier.eq.6) lvl = 1
4030  if(ier.ne.0) call xerror('abnormal return from dqawf',26,ier,lvl)
4031 
4032  return
4033  end subroutine dqawf
4034 
4035  !----------------------------------------------------------------------------------------
4280  subroutine dqawoe ( f, a, b, omega, integr, epsabs, epsrel, limit, icall, &
4281  maxp1, result, abserr, neval, ier, last, alist, blist, rlist, elist, iord, &
4282  nnlog, momcom, chebmo )
4284  implicit none
4285 
4286  real ( kind = 8 ) a,abseps,abserr,alist,area,area1,area12,area2,a1, &
4287  a2,b,blist,b1,b2,chebmo,correc,defab1,defab2,defabs, &
4288  domega,dres,elist,epmach,epsabs,epsrel,erlarg,erlast, &
4289  errbnd,errmax,error1,erro12,error2,errsum,ertest,f,oflow, &
4290  omega,resabs,reseps,result,res3la,rlist,rlist2,small,uflow,width
4291  integer ( kind = 4 ) icall,id,ier,ierro,integr,iord,iroff1,iroff2
4292  integer ( kind = 4 ) iroff3
4293  integer ( kind = 4 ) jupbnd
4294  integer ( kind = 4 ) k,ksgn,ktmin,last,limit,maxerr,maxp1,momcom,nev,neval, &
4295  nnlog,nres,nrmax,nrmom,numrl2
4296  logical extrap,noext,extall
4297 
4298  dimension alist(limit),blist(limit),rlist(limit),elist(limit), &
4299  iord(limit),rlist2(52),res3la(3),chebmo(maxp1,25),nnlog(limit)
4300  external f
4301 
4302  epmach = epsilon( epmach )
4303  !
4304  ! test on validity of parameters
4305  !
4306  ier = 0
4307  neval = 0
4308  last = 0
4309  result = 0.0d+00
4310  abserr = 0.0d+00
4311  alist(1) = a
4312  blist(1) = b
4313  rlist(1) = 0.0d+00
4314  elist(1) = 0.0d+00
4315  iord(1) = 0
4316  nnlog(1) = 0
4317  if((integr.ne.1.and.integr.ne.2).or.(epsabs.le.0.0d+00.and. &
4318  epsrel.lt. max( 0.5d+02*epmach,0.5d-28)).or.icall.lt.1.or. &
4319  maxp1.lt.1) ier = 6
4320  if(ier.eq.6) go to 999
4321  !
4322  ! first approximation to the integral
4323  !
4324  domega = abs( omega)
4325  nrmom = 0
4326  if (icall.gt.1) go to 5
4327  momcom = 0
4328 5 call dqc25f(f,a,b,domega,integr,nrmom,maxp1,0,result,abserr, &
4329  neval,defabs,resabs,momcom,chebmo)
4330  !
4331  ! test on accuracy.
4332  !
4333  dres = abs( result)
4334  errbnd = max( epsabs,epsrel*dres)
4335  rlist(1) = result
4336  elist(1) = abserr
4337  iord(1) = 1
4338  if(abserr.le.0.1d+03*epmach*defabs.and.abserr.gt.errbnd) ier = 2
4339  if(limit.eq.1) ier = 1
4340  if(ier.ne.0.or.abserr.le.errbnd) go to 200
4341  !
4342  ! initializations
4343  !
4344  uflow = tiny( uflow )
4345  oflow = huge( oflow )
4346  errmax = abserr
4347  maxerr = 1
4348  area = result
4349  errsum = abserr
4350  abserr = oflow
4351  nrmax = 1
4352  extrap = .false.
4353  noext = .false.
4354  ierro = 0
4355  iroff1 = 0
4356  iroff2 = 0
4357  iroff3 = 0
4358  ktmin = 0
4359  small = abs( b-a)*0.75d+00
4360  nres = 0
4361  numrl2 = 0
4362  extall = .false.
4363  if(0.5d+00* abs( b-a)*domega.gt.0.2d+01) go to 10
4364  numrl2 = 1
4365  extall = .true.
4366  rlist2(1) = result
4367 10 if(0.25d+00* abs( b-a)*domega.le.0.2d+01) extall = .true.
4368  ksgn = -1
4369  if(dres.ge.(0.1d+01-0.5d+02*epmach)*defabs) ksgn = 1
4370  !
4371  ! main do-loop
4372  !
4373  do 140 last = 2,limit
4374  !
4375  ! bisect the subinterval with the nrmax-th largest error estimate.
4376  !
4377  nrmom = nnlog(maxerr)+1
4378  a1 = alist(maxerr)
4379  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
4380  a2 = b1
4381  b2 = blist(maxerr)
4382  erlast = errmax
4383  call dqc25f(f,a1,b1,domega,integr,nrmom,maxp1,0, &
4384  area1,error1,nev,resabs,defab1,momcom,chebmo)
4385  neval = neval+nev
4386  call dqc25f(f,a2,b2,domega,integr,nrmom,maxp1,1, &
4387  area2,error2,nev,resabs,defab2,momcom,chebmo)
4388  neval = neval+nev
4389  !
4390  ! improve previous approximations to integral
4391  ! and error and test for accuracy.
4392  !
4393  area12 = area1+area2
4394  erro12 = error1+error2
4395  errsum = errsum+erro12-errmax
4396  area = area+area12-rlist(maxerr)
4397  if(defab1.eq.error1.or.defab2.eq.error2) go to 25
4398  if( abs( rlist(maxerr)-area12).gt.0.1d-04* abs( area12) &
4399  .or.erro12.lt.0.99d+00*errmax) go to 20
4400  if(extrap) iroff2 = iroff2+1
4401  if(.not.extrap) iroff1 = iroff1+1
4402 20 if(last.gt.10.and.erro12.gt.errmax) iroff3 = iroff3+1
4403 25 rlist(maxerr) = area1
4404  rlist(last) = area2
4405  nnlog(maxerr) = nrmom
4406  nnlog(last) = nrmom
4407  errbnd = max( epsabs,epsrel* abs( area))
4408  !
4409  ! test for roundoff error and eventually set error flag.
4410  !
4411  if(iroff1+iroff2.ge.10.or.iroff3.ge.20) ier = 2
4412  if(iroff2.ge.5) ierro = 3
4413  !
4414  ! set error flag in the case that the number of
4415  ! subintervals equals limit.
4416  !
4417  if(last.eq.limit) ier = 1
4418  !
4419  ! set error flag in the case of bad integrand behaviour
4420  ! at a point of the integration range.
4421  !
4422  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03*epmach) &
4423  *( abs( a2)+0.1d+04*uflow)) ier = 4
4424  !
4425  ! append the newly-created intervals to the list.
4426  !
4427  if(error2.gt.error1) go to 30
4428  alist(last) = a2
4429  blist(maxerr) = b1
4430  blist(last) = b2
4431  elist(maxerr) = error1
4432  elist(last) = error2
4433  go to 40
4434 30 alist(maxerr) = a2
4435  alist(last) = a1
4436  blist(last) = b1
4437  rlist(maxerr) = area2
4438  rlist(last) = area1
4439  elist(maxerr) = error2
4440  elist(last) = error1
4441  !
4442  ! call dqpsrt to maintain the descending ordering
4443  ! in the list of error estimates and select the subinterval
4444  ! with nrmax-th largest error estimate (to bisected next).
4445  !
4446 40 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
4447  if(errsum.le.errbnd) go to 170
4448  if(ier.ne.0) go to 150
4449  if(last.eq.2.and.extall) go to 120
4450  if(noext) go to 140
4451  if(.not.extall) go to 50
4452  erlarg = erlarg-erlast
4453  if( abs( b1-a1).gt.small) erlarg = erlarg+erro12
4454  if(extrap) go to 70
4455  !
4456  ! test whether the interval to be bisected next is the
4457  ! smallest interval.
4458  !
4459 50 width = abs( blist(maxerr)-alist(maxerr))
4460  if(width.gt.small) go to 140
4461  if(extall) go to 60
4462  !
4463  ! test whether we can start with the extrapolation procedure
4464  ! (we do this if we integrate over the next interval with
4465  ! use of a gauss-kronrod rule - see routine dqc25f).
4466  !
4467  small = small*0.5d+00
4468  if(0.25d+00*width*domega.gt.0.2d+01) go to 140
4469  extall = .true.
4470  go to 130
4471 60 extrap = .true.
4472  nrmax = 2
4473 70 if(ierro.eq.3.or.erlarg.le.ertest) go to 90
4474  !
4475  ! the smallest interval has the largest error.
4476  ! before bisecting decrease the sum of the errors over
4477  ! the larger intervals (erlarg) and perform extrapolation.
4478  !
4479  jupbnd = last
4480  if (last.gt.(limit/2+2)) jupbnd = limit+3-last
4481  id = nrmax
4482  do k = id,jupbnd
4483  maxerr = iord(nrmax)
4484  errmax = elist(maxerr)
4485  if( abs( blist(maxerr)-alist(maxerr)).gt.small) go to 140
4486  nrmax = nrmax+1
4487  end do
4488  !
4489  ! perform extrapolation.
4490  !
4491 90 numrl2 = numrl2+1
4492  rlist2(numrl2) = area
4493  if(numrl2.lt.3) go to 110
4494  call dqelg(numrl2,rlist2,reseps,abseps,res3la,nres)
4495  ktmin = ktmin+1
4496  if(ktmin.gt.5.and.abserr.lt.0.1d-02*errsum) ier = 5
4497  if(abseps.ge.abserr) go to 100
4498  ktmin = 0
4499  abserr = abseps
4500  result = reseps
4501  correc = erlarg
4502  ertest = max( epsabs,epsrel* abs( reseps))
4503  if(abserr.le.ertest) go to 150
4504  !
4505  ! prepare bisection of the smallest interval.
4506  !
4507 100 if(numrl2.eq.1) noext = .true.
4508  if(ier.eq.5) go to 150
4509 110 maxerr = iord(1)
4510  errmax = elist(maxerr)
4511  nrmax = 1
4512  extrap = .false.
4513  small = small*0.5d+00
4514  erlarg = errsum
4515  go to 140
4516 120 small = small*0.5d+00
4517  numrl2 = numrl2+1
4518  rlist2(numrl2) = area
4519 130 ertest = errbnd
4520  erlarg = errsum
4521 140 continue
4522  !
4523  ! set the final result.-
4524  !
4525 150 if(abserr.eq.oflow.or.nres.eq.0) go to 170
4526  if(ier+ierro.eq.0) go to 165
4527  if(ierro.eq.3) abserr = abserr+correc
4528  if(ier.eq.0) ier = 3
4529  if(result.ne.0.0d+00.and.area.ne.0.0d+00) go to 160
4530  if(abserr.gt.errsum) go to 170
4531  if(area.eq.0.0d+00) go to 190
4532  go to 165
4533 160 if(abserr/ abs( result).gt.errsum/ abs( area)) go to 170
4534  !
4535  ! test on divergence.
4536  !
4537 165 if(ksgn.eq.(-1).and. max( abs( result), abs( area)).le. &
4538  defabs*0.1d-01) go to 190
4539  if(0.1d-01.gt.(result/area).or.(result/area).gt.0.1d+03 &
4540  .or.errsum.ge. abs( area)) ier = 6
4541  go to 190
4542  !
4543  ! compute global integral sum.
4544  !
4545 170 result = 0.0d+00
4546  do k=1,last
4547  result = result+rlist(k)
4548  end do
4549  abserr = errsum
4550 190 if (ier.gt.2) ier=ier-1
4551 200 if (integr.eq.2.and.omega.lt.0.0d+00) result=-result
4552 999 continue
4553 
4554  return
4555 end subroutine dqawoe
4556 
4557  !----------------------------------------------------------------------------------------
4736 subroutine dqawo ( f, a, b, omega, integr, epsabs, epsrel, result, abserr, &
4737  neval, ier, leniw, maxp1, lenw, last, iwork, work )
4739  implicit none
4740 
4741  real ( kind = 8 ) a,abserr,b,epsabs,epsrel,f,omega,result,work
4742  integer ( kind = 4 ) ier,integr,iwork,last,limit,lenw,leniw,lvl,l
4743  integer ( kind = 4 ) l1
4744  integer ( kind = 4 ) l2
4745  integer ( kind = 4 ) l3
4746  integer ( kind = 4 ) l4
4747  integer ( kind = 4 ) maxp1,momcom,neval
4748  dimension iwork(leniw),work(lenw)
4749 
4750  external f
4751  !
4752  ! check validity of leniw, maxp1 and lenw.
4753  !
4754  ier = 6
4755  neval = 0
4756  last = 0
4757  result = 0.0d+00
4758  abserr = 0.0d+00
4759  if(leniw.lt.2.or.maxp1.lt.1.or.lenw.lt.(leniw*2+maxp1*25)) &
4760  go to 10
4761  !
4762  ! prepare call for dqawoe
4763  !
4764  limit = leniw/2
4765  l1 = limit+1
4766  l2 = limit+l1
4767  l3 = limit+l2
4768  l4 = limit+l3
4769  call dqawoe(f,a,b,omega,integr,epsabs,epsrel,limit,1,maxp1,result, &
4770  abserr,neval,ier,last,work(1),work(l1),work(l2),work(l3), &
4771  iwork(1),iwork(l1),momcom,work(l4))
4772  !
4773  ! call error handler if necessary
4774  !
4775  lvl = 0
4776 10 if(ier.eq.6) lvl = 0
4777  if(ier.ne.0) call xerror('abnormal return from dqawo',26,ier,lvl)
4778 
4779  return
4780 end subroutine dqawo
4781 
4782  !----------------------------------------------------------------------------------------
4958 subroutine dqawse(f,a,b,alfa,beta,integr,epsabs,epsrel,limit, &
4959  result,abserr,neval,ier,alist,blist,rlist,elist,iord,last)
4961  implicit none
4962 
4963  real ( kind = 8 ) a,abserr,alfa,alist,area,area1,area12,area2,a1, &
4964  a2,b,beta,blist,b1,b2,centre,elist,epmach, &
4965  epsabs,epsrel,errbnd,errmax,error1,erro12,error2,errsum,f, &
4966  resas1,resas2,result,rg,rh,ri,rj,rlist,uflow
4967  integer ( kind = 4 ) ier,integr,iord,iroff1,iroff2,k,last,limit
4968  integer( kind = 4 )maxerr
4969  integer ( kind = 4 ) nev
4970  integer ( kind = 4 ) neval,nrmax
4971 
4972  external f
4973 
4974  dimension alist(limit),blist(limit),rlist(limit),elist(limit), &
4975  iord(limit),ri(25),rj(25),rh(25),rg(25)
4976 
4977  epmach = epsilon( epmach )
4978  uflow = tiny( uflow )
4979  !
4980  ! test on validity of parameters
4981  !
4982  neval = 0
4983  last = 0
4984  rlist(1) = 0.0d+00
4985  elist(1) = 0.0d+00
4986  iord(1) = 0
4987  result = 0.0d+00
4988  abserr = 0.0d+00
4989 
4990  if ( b.le.a .or. &
4991  (epsabs.eq.0.0d+00 .and. epsrel .lt. max( 0.5d+02*epmach,0.5d-28) ) .or. &
4992  alfa .le. (-0.1d+01) .or. &
4993  beta .le. (-0.1d+01) .or. &
4994  integr.lt.1 .or. &
4995  integr.gt.4 .or. &
4996  limit.lt.2 ) then
4997  ier = 6
4998  return
4999  end if
5000 
5001  ier = 0
5002  !
5003  ! compute the modified chebyshev moments.
5004  !
5005  call dqmomo(alfa,beta,ri,rj,rg,rh,integr)
5006  !
5007  ! integrate over the intervals (a,(a+b)/2) and ((a+b)/2,b).
5008  !
5009  centre = 0.5d+00*(b+a)
5010  call dqc25s(f,a,b,a,centre,alfa,beta,ri,rj,rg,rh,area1, &
5011  error1,resas1,integr,nev)
5012  neval = nev
5013  call dqc25s(f,a,b,centre,b,alfa,beta,ri,rj,rg,rh,area2, &
5014  error2,resas2,integr,nev)
5015  last = 2
5016  neval = neval+nev
5017  result = area1+area2
5018  abserr = error1+error2
5019  !
5020  ! test on accuracy.
5021  !
5022  errbnd = max( epsabs,epsrel* abs( result))
5023  !
5024  ! initialization
5025  !
5026  if ( error2 .le. error1 ) then
5027  alist(1) = a
5028  alist(2) = centre
5029  blist(1) = centre
5030  blist(2) = b
5031  rlist(1) = area1
5032  rlist(2) = area2
5033  elist(1) = error1
5034  elist(2) = error2
5035  else
5036  alist(1) = centre
5037  alist(2) = a
5038  blist(1) = b
5039  blist(2) = centre
5040  rlist(1) = area2
5041  rlist(2) = area1
5042  elist(1) = error2
5043  elist(2) = error1
5044  end if
5045 
5046  iord(1) = 1
5047  iord(2) = 2
5048  if(limit.eq.2) ier = 1
5049 
5050  if(abserr.le.errbnd.or.ier.eq.1) then
5051  return
5052  end if
5053 
5054  errmax = elist(1)
5055  maxerr = 1
5056  nrmax = 1
5057  area = result
5058  errsum = abserr
5059  iroff1 = 0
5060  iroff2 = 0
5061  !
5062  ! main do-loop
5063  !
5064  do 60 last = 3,limit
5065  !
5066  ! bisect the subinterval with largest error estimate.
5067  !
5068  a1 = alist(maxerr)
5069  b1 = 0.5d+00*(alist(maxerr)+blist(maxerr))
5070  a2 = b1
5071  b2 = blist(maxerr)
5072 
5073  call dqc25s(f,a,b,a1,b1,alfa,beta,ri,rj,rg,rh,area1, &
5074  error1,resas1,integr,nev)
5075  neval = neval+nev
5076  call dqc25s(f,a,b,a2,b2,alfa,beta,ri,rj,rg,rh,area2, &
5077  error2,resas2,integr,nev)
5078  neval = neval+nev
5079  !
5080  ! improve previous approximations integral and error and test for accuracy.
5081  !
5082  area12 = area1+area2
5083  erro12 = error1+error2
5084  errsum = errsum+erro12-errmax
5085  area = area+area12-rlist(maxerr)
5086  if(a.eq.a1.or.b.eq.b2) go to 30
5087  if(resas1.eq.error1.or.resas2.eq.error2) go to 30
5088  !
5089  ! test for roundoff error.
5090  !
5091  if( abs( rlist(maxerr)-area12).lt.0.1d-04* abs( area12) &
5092  .and.erro12.ge.0.99d+00*errmax) iroff1 = iroff1+1
5093  if(last.gt.10.and.erro12.gt.errmax) iroff2 = iroff2+1
5094 30 rlist(maxerr) = area1
5095  rlist(last) = area2
5096  !
5097  ! test on accuracy.
5098  !
5099  errbnd = max( epsabs,epsrel* abs( area))
5100  if(errsum.le.errbnd) go to 35
5101  !
5102  ! set error flag in the case that the number of interval
5103  ! bisections exceeds limit.
5104  !
5105  if(last.eq.limit) ier = 1
5106  !
5107  ! set error flag in the case of roundoff error.
5108  !
5109  if(iroff1.ge.6.or.iroff2.ge.20) ier = 2
5110  !
5111  ! set error flag in the case of bad integrand behaviour
5112  ! at interior points of integration range.
5113  !
5114  if( max( abs( a1), abs( b2)).le.(0.1d+01+0.1d+03*epmach)* &
5115  ( abs( a2)+0.1d+04*uflow)) ier = 3
5116  !
5117  ! append the newly-created intervals to the list.
5118  !
5119 35 if(error2.gt.error1) go to 40
5120  alist(last) = a2
5121  blist(maxerr) = b1
5122  blist(last) = b2
5123  elist(maxerr) = error1
5124  elist(last) = error2
5125  go to 50
5126 
5127 40 alist(maxerr) = a2
5128  alist(last) = a1
5129  blist(last) = b1
5130  rlist(maxerr) = area2
5131  rlist(last) = area1
5132  elist(maxerr) = error2
5133  elist(last) = error1
5134  !
5135  ! call dqpsrt to maintain the descending ordering
5136  ! in the list of error estimates and select the subinterval
5137  ! with largest error estimate (to be bisected next).
5138  !
5139 50 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax)
5140  if (ier.ne.0.or.errsum.le.errbnd) go to 70
5141 60 continue
5142 !
5143 ! compute final result.
5144 !
5145 70 continue
5146 
5147  result = 0.0d+00
5148  do k=1,last
5149  result = result+rlist(k)
5150  end do
5151 
5152  abserr = errsum
5153 999 continue
5154 
5155  return
5156 end subroutine dqawse
5157 
5158  !----------------------------------------------------------------------------------------
5316 subroutine dqaws ( f, a, b, alfa, beta, integr, epsabs, epsrel, result, &
5317  abserr, neval, ier, limit, lenw, last, iwork, work )
5319  implicit none
5320 
5321  real ( kind = 8 ) a,abserr,alfa,b,beta,epsabs,epsrel,f,result,work
5322  integer ( kind = 4 ) ier,integr,iwork,last,lenw,limit,lvl,l1,l2,l3
5323  integer ( kind = 4 ) neval
5324  dimension iwork(limit),work(lenw)
5325 
5326  external f
5327  !
5328  ! check validity of limit and lenw.
5329  !
5330  ier = 6
5331  neval = 0
5332  last = 0
5333  result = 0.0d+00
5334  abserr = 0.0d+00
5335  if(limit.lt.2.or.lenw.lt.limit*4) go to 10
5336  !
5337  ! prepare call for dqawse.
5338  !
5339  l1 = limit+1
5340  l2 = limit+l1
5341  l3 = limit+l2
5342 
5343  call dqawse(f,a,b,alfa,beta,integr,epsabs,epsrel,limit,result, &
5344  abserr,neval,ier,work(1),work(l1),work(l2),work(l3),iwork,last)
5345  !
5346  ! call error handler if necessary.
5347  !
5348  lvl = 0
5349 10 if(ier.eq.6) lvl = 1
5350  if(ier.ne.0) call xerror('abnormal return from dqaws',26,ier,lvl)
5351 
5352  return
5353 end subroutine dqaws
5354 
5355  !----------------------------------------------------------------------------------------
5425 subroutine dqc25c(f,a,b,c,result,abserr,krul,neval)
5427  implicit none
5428 
5429  real ( kind = 8 ) a,abserr,ak22,amom0,amom1,amom2,b,c,cc,centr, &
5430  cheb12,cheb24,f,fval,hlgth,p2,p3,p4,resabs, &
5431  resasc,result,res12,res24,u,x
5432  integer ( kind = 4 ) i,isym,k,kp,krul,neval
5433  dimension x(11),fval(25),cheb12(13),cheb24(25)
5434 
5435  external f
5436 
5437  data x(1) / 0.991444861373810411144557526928563d0 /
5438  data x(2) / 0.965925826289068286749743199728897d0 /
5439  data x(3) / 0.923879532511286756128183189396788d0 /
5440  data x(4) / 0.866025403784438646763723170752936d0 /
5441  data x(5) / 0.793353340291235164579776961501299d0 /
5442  data x(6) / 0.707106781186547524400844362104849d0 /
5443  data x(7) / 0.608761429008720639416097542898164d0 /
5444  data x(8) / 0.500000000000000000000000000000000d0 /
5445  data x(9) / 0.382683432365089771728459984030399d0 /
5446  data x(10) / 0.258819045102520762348898837624048d0 /
5447  data x(11) / 0.130526192220051591548406227895489d0 /
5448  !
5449  ! check the position of c.
5450  !
5451  cc = (0.2d+01*c-b-a)/(b-a)
5452  if( abs( cc).lt.0.11d+01) go to 10
5453  !
5454  ! apply the 15-point gauss-kronrod scheme.
5455  !
5456  krul = krul-1
5457  call dqk15w(f,dqwgtc,c,p2,p3,p4,kp,a,b,result,abserr, &
5458  resabs,resasc)
5459  neval = 15
5460  if (resasc.eq.abserr) krul = krul+1
5461  go to 50
5462  !
5463  ! use the generalized clenshaw-curtis method.
5464  !
5465 10 hlgth = 0.5d+00*(b-a)
5466  centr = 0.5d+00*(b+a)
5467  neval = 25
5468  fval(1) = 0.5d+00*f(hlgth+centr)
5469  fval(13) = f(centr)
5470  fval(25) = 0.5d+00*f(centr-hlgth)
5471 
5472  do i=2,12
5473  u = hlgth*x(i-1)
5474  isym = 26-i
5475  fval(i) = f(u+centr)
5476  fval(isym) = f(centr-u)
5477  end do
5478  !
5479  ! compute the chebyshev series expansion.
5480  !
5481  call dqcheb(x,fval,cheb12,cheb24)
5482  !
5483  ! the modified chebyshev moments are computed by forward
5484  ! recursion, using amom0 and amom1 as starting values.
5485  !
5486  amom0 = log( abs( (0.1d+01-cc)/(0.1d+01+cc)))
5487  amom1 = 0.2d+01+cc*amom0
5488  res12 = cheb12(1)*amom0+cheb12(2)*amom1
5489  res24 = cheb24(1)*amom0+cheb24(2)*amom1
5490 
5491  do k=3,13
5492  amom2 = 0.2d+01*cc*amom1-amom0
5493  ak22 = (k-2)*(k-2)
5494  if((k/2)*2.eq.k) amom2 = amom2-0.4d+01/(ak22-0.1d+01)
5495  res12 = res12+cheb12(k)*amom2
5496  res24 = res24+cheb24(k)*amom2
5497  amom0 = amom1
5498  amom1 = amom2
5499  end do
5500 
5501  do k=14,25
5502  amom2 = 0.2d+01*cc*amom1-amom0
5503  ak22 = (k-2)*(k-2)
5504  if((k/2)*2.eq.k) amom2 = amom2-0.4d+01/(ak22-0.1d+01)
5505  res24 = res24+cheb24(k)*amom2
5506  amom0 = amom1
5507  amom1 = amom2
5508  end do
5509 
5510  result = res24
5511  abserr = abs( res24-res12)
5512 50 continue
5513 
5514  return
5515  end subroutine dqc25c
5516 
5517  !----------------------------------------------------------------------------------------
5635  subroutine dqc25f(f,a,b,omega,integr,nrmom,maxp1,ksave,result, &
5636  abserr,neval,resabs,resasc,momcom,chebmo)
5638  implicit none
5639 
5640  real ( kind = 8 ) a,abserr,ac,an,an2,as,asap,ass,b,centr,chebmo, &
5641  cheb12,cheb24,conc,cons,cospar,d,d1, &
5642  d2,estc,ests,f,fval,hlgth,oflow,omega,parint,par2,par22, &
5643  p2,p3,p4,resabs,resasc,resc12,resc24,ress12,ress24,result, &
5644  sinpar,v,x
5645  integer ( kind = 4 ) i,iers,integr,isym,j,k,ksave,m,momcom,neval, maxp1,&
5646  noequ,noeq1,nrmom
5647  dimension chebmo(maxp1,25),cheb12(13),cheb24(25),d(25),d1(25), &
5648  d2(25),fval(25),v(28),x(11)
5649 
5650  external f
5651 
5652  data x(1) / 0.991444861373810411144557526928563d0 /
5653  data x(2) / 0.965925826289068286749743199728897d0 /
5654  data x(3) / 0.923879532511286756128183189396788d0 /
5655  data x(4) / 0.866025403784438646763723170752936d0 /
5656  data x(5) / 0.793353340291235164579776961501299d0 /
5657  data x(6) / 0.707106781186547524400844362104849d0 /
5658  data x(7) / 0.608761429008720639416097542898164d0 /
5659  data x(8) / 0.500000000000000000000000000000000d0 /
5660  data x(9) / 0.382683432365089771728459984030399d0 /
5661  data x(10) / 0.258819045102520762348898837624048d0 /
5662  data x(11) / 0.130526192220051591548406227895489d0 /
5663 
5664  oflow = huge( oflow )
5665  centr = 0.5d+00*(b+a)
5666  hlgth = 0.5d+00*(b-a)
5667  parint = omega*hlgth
5668  !
5669  ! compute the integral using the 15-point gauss-kronrod
5670  ! formula if the value of the parameter in the integrand is small.
5671  !
5672  if( abs( parint).gt.0.2d+01) go to 10
5673  call dqk15w(f,dqwgtf,omega,p2,p3,p4,integr,a,b,result, &
5674  abserr,resabs,resasc)
5675  neval = 15
5676  go to 170
5677  !
5678  ! compute the integral using the generalized clenshaw-
5679  ! curtis method.
5680  !
5681 10 conc = hlgth*dcos(centr*omega)
5682  cons = hlgth*dsin(centr*omega)
5683  resasc = oflow
5684  neval = 25
5685  !
5686  ! check whether the chebyshev moments for this interval
5687  ! have already been computed.
5688  !
5689  if(nrmom.lt.momcom.or.ksave.eq.1) go to 120
5690  !
5691  ! compute a new set of chebyshev moments.
5692  !
5693  m = momcom+1
5694  par2 = parint*parint
5695  par22 = par2+0.2d+01
5696  sinpar = dsin(parint)
5697  cospar = dcos(parint)
5698  !
5699  ! compute the chebyshev moments with respect to cosine.
5700  !
5701  v(1) = 0.2d+01*sinpar/parint
5702  v(2) = (0.8d+01*cospar+(par2+par2-0.8d+01)*sinpar/parint)/par2
5703  v(3) = (0.32d+02*(par2-0.12d+02)*cospar+(0.2d+01* &
5704  ((par2-0.80d+02)*par2+0.192d+03)*sinpar)/parint)/(par2*par2)
5705  ac = 0.8d+01*cospar
5706  as = 0.24d+02*parint*sinpar
5707  if( abs( parint).gt.0.24d+02) go to 30
5708  !
5709  ! compute the chebyshev moments as the solutions of a
5710  ! boundary value problem with 1 initial value (v(3)) and 1
5711  ! end value (computed using an asymptotic formula).
5712  !
5713  noequ = 25
5714  noeq1 = noequ-1
5715  an = 0.6d+01
5716 
5717  do k = 1,noeq1
5718  an2 = an*an
5719  d(k) = -0.2d+01*(an2-0.4d+01)*(par22-an2-an2)
5720  d2(k) = (an-0.1d+01)*(an-0.2d+01)*par2
5721  d1(k+1) = (an+0.3d+01)*(an+0.4d+01)*par2
5722  v(k+3) = as-(an2-0.4d+01)*ac
5723  an = an+0.2d+01
5724  end do
5725 
5726  an2 = an*an
5727  d(noequ) = -0.2d+01*(an2-0.4d+01)*(par22-an2-an2)
5728  v(noequ+3) = as-(an2-0.4d+01)*ac
5729  v(4) = v(4)-0.56d+02*par2*v(3)
5730  ass = parint*sinpar
5731  asap = (((((0.210d+03*par2-0.1d+01)*cospar-(0.105d+03*par2 &
5732  -0.63d+02)*ass)/an2-(0.1d+01-0.15d+02*par2)*cospar &
5733  +0.15d+02*ass)/an2-cospar+0.3d+01*ass)/an2-cospar)/an2
5734  v(noequ+3) = v(noequ+3)-0.2d+01*asap*par2*(an-0.1d+01)* &
5735  (an-0.2d+01)
5736  !
5737  ! solve the tridiagonal system by means of gaussian
5738  ! elimination with partial pivoting.
5739  !
5740  call dgtsl(noequ,d1,d,d2,v(4),iers)
5741  go to 50
5742  !
5743  ! compute the chebyshev moments by means of forward recursion.
5744  !
5745 30 an = 0.4d+01
5746 
5747  do i = 4,13
5748  an2 = an*an
5749  v(i) = ((an2-0.4d+01)*(0.2d+01*(par22-an2-an2)*v(i-1)-ac) &
5750  +as-par2*(an+0.1d+01)*(an+0.2d+01)*v(i-2))/ &
5751  (par2*(an-0.1d+01)*(an-0.2d+01))
5752  an = an+0.2d+01
5753  end do
5754 
5755 50 continue
5756 
5757  do j = 1,13
5758  chebmo(m,2*j-1) = v(j)
5759  end do
5760  !
5761  ! compute the chebyshev moments with respect to sine.
5762  !
5763  v(1) = 0.2d+01*(sinpar-parint*cospar)/par2
5764  v(2) = (0.18d+02-0.48d+02/par2)*sinpar/par2 &
5765  +(-0.2d+01+0.48d+02/par2)*cospar/parint
5766  ac = -0.24d+02*parint*cospar
5767  as = -0.8d+01*sinpar
5768  if( abs( parint).gt.0.24d+02) go to 80
5769  !
5770  ! compute the chebyshev moments as the solutions of a boundary
5771  ! value problem with 1 initial value (v(2)) and 1 end value
5772  ! (computed using an asymptotic formula).
5773  !
5774  an = 0.5d+01
5775 
5776  do k = 1,noeq1
5777  an2 = an*an
5778  d(k) = -0.2d+01*(an2-0.4d+01)*(par22-an2-an2)
5779  d2(k) = (an-0.1d+01)*(an-0.2d+01)*par2
5780  d1(k+1) = (an+0.3d+01)*(an+0.4d+01)*par2
5781  v(k+2) = ac+(an2-0.4d+01)*as
5782  an = an+0.2d+01
5783  end do
5784 
5785  an2 = an*an
5786  d(noequ) = -0.2d+01*(an2-0.4d+01)*(par22-an2-an2)
5787  v(noequ+2) = ac+(an2-0.4d+01)*as
5788  v(3) = v(3)-0.42d+02*par2*v(2)
5789  ass = parint*cospar
5790  asap = (((((0.105d+03*par2-0.63d+02)*ass+(0.210d+03*par2 &
5791  -0.1d+01)*sinpar)/an2+(0.15d+02*par2-0.1d+01)*sinpar- &
5792  0.15d+02*ass)/an2-0.3d+01*ass-sinpar)/an2-sinpar)/an2
5793  v(noequ+2) = v(noequ+2)-0.2d+01*asap*par2*(an-0.1d+01) &
5794  *(an-0.2d+01)
5795  !
5796  ! solve the tridiagonal system by means of gaussian
5797  ! elimination with partial pivoting.
5798  !
5799  call dgtsl(noequ,d1,d,d2,v(3),iers)
5800  go to 100
5801  !
5802  ! compute the chebyshev moments by means of forward recursion.
5803  !
5804 80 an = 0.3d+01
5805 
5806  do i = 3,12
5807  an2 = an*an
5808  v(i) = ((an2-0.4d+01)*(0.2d+01*(par22-an2-an2)*v(i-1)+as) &
5809  +ac-par2*(an+0.1d+01)*(an+0.2d+01)*v(i-2)) &
5810  /(par2*(an-0.1d+01)*(an-0.2d+01))
5811  an = an+0.2d+01
5812  end do
5813 
5814 100 continue
5815 
5816  do j = 1,12
5817  chebmo(m,2*j) = v(j)
5818  end do
5819 
5820 120 if (nrmom.lt.momcom) m = nrmom+1
5821  if (momcom.lt.(maxp1-1).and.nrmom.ge.momcom) momcom = momcom+1
5822  !
5823  ! compute the coefficients of the chebyshev expansions
5824  ! of degrees 12 and 24 of the function f.
5825  !
5826  fval(1) = 0.5d+00*f(centr+hlgth)
5827  fval(13) = f(centr)
5828  fval(25) = 0.5d+00*f(centr-hlgth)
5829  do i = 2,12
5830  isym = 26-i
5831  fval(i) = f(hlgth*x(i-1)+centr)
5832  fval(isym) = f(centr-hlgth*x(i-1))
5833  end do
5834  call dqcheb(x,fval,cheb12,cheb24)
5835  !
5836  ! compute the integral and error estimates.
5837  !
5838  resc12 = cheb12(13)*chebmo(m,13)
5839  ress12 = 0.0d+00
5840  k = 11
5841  do j = 1,6
5842  resc12 = resc12+cheb12(k)*chebmo(m,k)
5843  ress12 = ress12+cheb12(k+1)*chebmo(m,k+1)
5844  k = k-2
5845  end do
5846  resc24 = cheb24(25)*chebmo(m,25)
5847  ress24 = 0.0d+00
5848  resabs = abs( cheb24(25))
5849  k = 23
5850  do j = 1,12
5851  resc24 = resc24+cheb24(k)*chebmo(m,k)
5852  ress24 = ress24+cheb24(k+1)*chebmo(m,k+1)
5853  resabs = abs( cheb24(k))+ abs( cheb24(k+1))
5854  k = k-2
5855  end do
5856  estc = abs( resc24-resc12)
5857  ests = abs( ress24-ress12)
5858  resabs = resabs* abs( hlgth)
5859  if(integr.eq.2) go to 160
5860  result = conc*resc24-cons*ress24
5861  abserr = abs( conc*estc)+ abs( cons*ests)
5862  go to 170
5863 160 result = conc*ress24+cons*resc24
5864  abserr = abs( conc*ests)+ abs( cons*estc)
5865 170 continue
5866 
5867  return
5868 end subroutine dqc25f
5869 
5870  !----------------------------------------------------------------------------------------
5964 subroutine dqc25s(f,a,b,bl,br,alfa,beta,ri,rj,rg,rh,result, &
5965  abserr,resasc,integr,nev)
5967  implicit none
5968 
5969  real ( kind = 8 ) a,abserr,alfa,b,beta,bl,br,centr,cheb12,cheb24, &
5970  dc,f,factor,fix,fval,hlgth,resabs,resasc,result,res12, &
5971  res24,rg,rh,ri,rj,u,x
5972  integer ( kind = 4 ) i,integr,isym,nev
5973 
5974  dimension cheb12(13),cheb24(25),fval(25),rg(25),rh(25),ri(25), &
5975  rj(25),x(11)
5976 
5977  external f
5978 
5979  data x(1) / 0.991444861373810411144557526928563d0 /
5980  data x(2) / 0.965925826289068286749743199728897d0 /
5981  data x(3) / 0.923879532511286756128183189396788d0 /
5982  data x(4) / 0.866025403784438646763723170752936d0 /
5983  data x(5) / 0.793353340291235164579776961501299d0 /
5984  data x(6) / 0.707106781186547524400844362104849d0 /
5985  data x(7) / 0.608761429008720639416097542898164d0 /
5986  data x(8) / 0.500000000000000000000000000000000d0 /
5987  data x(9) / 0.382683432365089771728459984030399d0 /
5988  data x(10) / 0.258819045102520762348898837624048d0 /
5989  data x(11) / 0.130526192220051591548406227895489d0 /
5990 
5991  nev = 25
5992  if(bl.eq.a.and.(alfa.ne.0.0d+00.or.integr.eq.2.or.integr.eq.4)) &
5993  go to 10
5994  if(br.eq.b.and.(beta.ne.0.0d+00.or.integr.eq.3.or.integr.eq.4)) &
5995  go to 140
5996  !
5997  ! if a.gt.bl and b.lt.br, apply the 15-point gauss-kronrod scheme.
5998  !
5999  !
6000  call dqk15w(f,dqwgts,a,b,alfa,beta,integr,bl,br, &
6001  result,abserr,resabs,resasc)
6002  nev = 15
6003  go to 270
6004  !
6005  ! this part of the program is executed only if a = bl.
6006  !
6007  ! compute the chebyshev series expansion of the
6008  ! following function
6009  ! f1 = (0.5*(b+b-br-a)-0.5*(br-a)*x)**beta
6010  ! *f(0.5*(br-a)*x+0.5*(br+a))
6011  !
6012 10 hlgth = 0.5d+00*(br-bl)
6013  centr = 0.5d+00*(br+bl)
6014  fix = b-centr
6015  fval(1) = 0.5d+00*f(hlgth+centr)*(fix-hlgth)**beta
6016  fval(13) = f(centr)*(fix**beta)
6017  fval(25) = 0.5d+00*f(centr-hlgth)*(fix+hlgth)**beta
6018  do i=2,12
6019  u = hlgth*x(i-1)
6020  isym = 26-i
6021  fval(i) = f(u+centr)*(fix-u)**beta
6022  fval(isym) = f(centr-u)*(fix+u)**beta
6023  end do
6024 
6025  factor = hlgth**(alfa+0.1d+01)
6026  result = 0.0d+00
6027  abserr = 0.0d+00
6028  res12 = 0.0d+00
6029  res24 = 0.0d+00
6030  if(integr.gt.2) go to 70
6031  call dqcheb(x,fval,cheb12,cheb24)
6032  !
6033  ! integr = 1 (or 2)
6034  !
6035  do i=1,13
6036  res12 = res12+cheb12(i)*ri(i)
6037  res24 = res24+cheb24(i)*ri(i)
6038  end do
6039 
6040  do i=14,25
6041  res24 = res24+cheb24(i)*ri(i)
6042  end do
6043 
6044  if(integr.eq.1) go to 130
6045  !
6046  ! integr = 2
6047  !
6048  dc = log(br-bl)
6049  result = res24*dc
6050  abserr = abs( (res24-res12)*dc)
6051  res12 = 0.0d+00
6052  res24 = 0.0d+00
6053  do i=1,13
6054  res12 = res12+cheb12(i)*rg(i)
6055  res24 = res12+cheb24(i)*rg(i)
6056  end do
6057  do i=14,25
6058  res24 = res24+cheb24(i)*rg(i)
6059  end do
6060  go to 130
6061  !
6062  ! compute the chebyshev series expansion of the
6063  ! following function
6064  ! f4 = f1*log(0.5*(b+b-br-a)-0.5*(br-a)*x)
6065  !
6066 70 fval(1) = fval(1)* log(fix-hlgth)
6067  fval(13) = fval(13)* log(fix)
6068  fval(25) = fval(25)* log(fix+hlgth)
6069  do i=2,12
6070  u = hlgth*x(i-1)
6071  isym = 26-i
6072  fval(i) = fval(i)* log(fix-u)
6073  fval(isym) = fval(isym)* log(fix+u)
6074  end do
6075  call dqcheb(x,fval,cheb12,cheb24)
6076  !
6077  ! integr = 3 (or 4)
6078  !
6079  do i=1,13
6080  res12 = res12+cheb12(i)*ri(i)
6081  res24 = res24+cheb24(i)*ri(i)
6082  end do
6083 
6084  do i=14,25
6085  res24 = res24+cheb24(i)*ri(i)
6086  end do
6087  if(integr.eq.3) go to 130
6088  !
6089  ! integr = 4
6090  !
6091  dc = log(br-bl)
6092  result = res24*dc
6093  abserr = abs( (res24-res12)*dc)
6094  res12 = 0.0d+00
6095  res24 = 0.0d+00
6096  do i=1,13
6097  res12 = res12+cheb12(i)*rg(i)
6098  res24 = res24+cheb24(i)*rg(i)
6099  end do
6100  do i=14,25
6101  res24 = res24+cheb24(i)*rg(i)
6102  end do
6103 130 result = (result+res24)*factor
6104  abserr = (abserr+ abs( res24-res12))*factor
6105  go to 270
6106  !
6107  ! this part of the program is executed only if b = br.
6108  !
6109  ! compute the chebyshev series expansion of the following function:
6110  !
6111  ! f2 = (0.5*(b+bl-a-a)+0.5*(b-bl)*x)**alfa*f(0.5*(b-bl)*x+0.5*(b+bl))
6112  !
6113 140 hlgth = 0.5d+00*(br-bl)
6114  centr = 0.5d+00*(br+bl)
6115  fix = centr-a
6116  fval(1) = 0.5d+00*f(hlgth+centr)*(fix+hlgth)**alfa
6117  fval(13) = f(centr)*(fix**alfa)
6118  fval(25) = 0.5d+00*f(centr-hlgth)*(fix-hlgth)**alfa
6119  do i=2,12
6120  u = hlgth*x(i-1)
6121  isym = 26-i
6122  fval(i) = f(u+centr)*(fix+u)**alfa
6123  fval(isym) = f(centr-u)*(fix-u)**alfa
6124  end do
6125  factor = hlgth**(beta+0.1d+01)
6126  result = 0.0d+00
6127  abserr = 0.0d+00
6128  res12 = 0.0d+00
6129  res24 = 0.0d+00
6130  if(integr.eq.2.or.integr.eq.4) go to 200
6131  !
6132  ! integr = 1 (or 3)
6133  !
6134  call dqcheb(x,fval,cheb12,cheb24)
6135 
6136  do i=1,13
6137  res12 = res12+cheb12(i)*rj(i)
6138  res24 = res24+cheb24(i)*rj(i)
6139  end do
6140 
6141  do i=14,25
6142  res24 = res24+cheb24(i)*rj(i)
6143  end do
6144 
6145  if(integr.eq.1) go to 260
6146  !
6147  ! integr = 3
6148  !
6149  dc = log(br-bl)
6150  result = res24*dc
6151  abserr = abs( (res24-res12)*dc)
6152  res12 = 0.0d+00
6153  res24 = 0.0d+00
6154  do i=1,13
6155  res12 = res12+cheb12(i)*rh(i)
6156  res24 = res24+cheb24(i)*rh(i)
6157  end do
6158 
6159  do i=14,25
6160  res24 = res24+cheb24(i)*rh(i)
6161  end do
6162  go to 260
6163  !
6164  ! compute the chebyshev series expansion of the
6165  ! following function
6166  ! f3 = f2*log(0.5*(b-bl)*x+0.5*(b+bl-a-a))
6167  !
6168 200 fval(1) = fval(1)* log(hlgth+fix)
6169  fval(13) = fval(13)* log(fix)
6170  fval(25) = fval(25)* log(fix-hlgth)
6171  do i=2,12
6172  u = hlgth*x(i-1)
6173  isym = 26-i
6174  fval(i) = fval(i)* log(u+fix)
6175  fval(isym) = fval(isym)* log(fix-u)
6176  end do
6177  call dqcheb(x,fval,cheb12,cheb24)
6178  !
6179  ! integr = 2 (or 4)
6180  !
6181  do i=1,13
6182  res12 = res12+cheb12(i)*rj(i)
6183  res24 = res24+cheb24(i)*rj(i)
6184  end do
6185 
6186  do i=14,25
6187  res24 = res24+cheb24(i)*rj(i)
6188  end do
6189 
6190  if(integr.eq.2) go to 260
6191  dc = log(br-bl)
6192  result = res24*dc
6193  abserr = abs( (res24-res12)*dc)
6194  res12 = 0.0d+00
6195  res24 = 0.0d+00
6196  !
6197  ! integr = 4
6198  !
6199  do i=1,13
6200  res12 = res12+cheb12(i)*rh(i)
6201  res24 = res24+cheb24(i)*rh(i)
6202  end do
6203 
6204  do i=14,25
6205  res24 = res24+cheb24(i)*rh(i)
6206  end do
6207 
6208 260 result = (result+res24)*factor
6209  abserr = (abserr+ abs( res24-res12))*factor
6210 270 return
6211 end subroutine dqc25s
6212 
6213  !----------------------------------------------------------------------------------------
6255 subroutine dqcheb ( x, fval, cheb12, cheb24 )
6257  implicit none
6258 
6259  real ( kind = 8 ) alam,alam1,alam2,cheb12,cheb24,fval,part1,part2, &
6260  part3,v,x
6261  integer ( kind = 4 ) i,j
6262 
6263  dimension cheb12(13),cheb24(25),fval(25),v(12),x(11)
6264 
6265  do i=1,12
6266  j = 26-i
6267  v(i) = fval(i)-fval(j)
6268  fval(i) = fval(i)+fval(j)
6269  end do
6270 
6271  alam1 = v(1)-v(9)
6272  alam2 = x(6)*(v(3)-v(7)-v(11))
6273  cheb12(4) = alam1+alam2
6274  cheb12(10) = alam1-alam2
6275  alam1 = v(2)-v(8)-v(10)
6276  alam2 = v(4)-v(6)-v(12)
6277  alam = x(3)*alam1+x(9)*alam2
6278  cheb24(4) = cheb12(4)+alam
6279  cheb24(22) = cheb12(4)-alam
6280  alam = x(9)*alam1-x(3)*alam2
6281  cheb24(10) = cheb12(10)+alam
6282  cheb24(16) = cheb12(10)-alam
6283  part1 = x(4)*v(5)
6284  part2 = x(8)*v(9)
6285  part3 = x(6)*v(7)
6286  alam1 = v(1)+part1+part2
6287  alam2 = x(2)*v(3)+part3+x(10)*v(11)
6288  cheb12(2) = alam1+alam2
6289  cheb12(12) = alam1-alam2
6290  alam = x(1)*v(2)+x(3)*v(4)+x(5)*v(6)+x(7)*v(8) &
6291  +x(9)*v(10)+x(11)*v(12)
6292  cheb24(2) = cheb12(2)+alam
6293  cheb24(24) = cheb12(2)-alam
6294  alam = x(11)*v(2)-x(9)*v(4)+x(7)*v(6)-x(5)*v(8) &
6295  +x(3)*v(10)-x(1)*v(12)
6296  cheb24(12) = cheb12(12)+alam
6297  cheb24(14) = cheb12(12)-alam
6298  alam1 = v(1)-part1+part2
6299  alam2 = x(10)*v(3)-part3+x(2)*v(11)
6300  cheb12(6) = alam1+alam2
6301  cheb12(8) = alam1-alam2
6302  alam = x(5)*v(2)-x(9)*v(4)-x(1)*v(6) &
6303  -x(11)*v(8)+x(3)*v(10)+x(7)*v(12)
6304  cheb24(6) = cheb12(6)+alam
6305  cheb24(20) = cheb12(6)-alam
6306  alam = x(7)*v(2)-x(3)*v(4)-x(11)*v(6)+x(1)*v(8) &
6307  -x(9)*v(10)-x(5)*v(12)
6308  cheb24(8) = cheb12(8)+alam
6309  cheb24(18) = cheb12(8)-alam
6310 
6311  do i=1,6
6312  j = 14-i
6313  v(i) = fval(i)-fval(j)
6314  fval(i) = fval(i)+fval(j)
6315  end do
6316 
6317  alam1 = v(1)+x(8)*v(5)
6318  alam2 = x(4)*v(3)
6319  cheb12(3) = alam1+alam2
6320  cheb12(11) = alam1-alam2
6321  cheb12(7) = v(1)-v(5)
6322  alam = x(2)*v(2)+x(6)*v(4)+x(10)*v(6)
6323  cheb24(3) = cheb12(3)+alam
6324  cheb24(23) = cheb12(3)-alam
6325  alam = x(6)*(v(2)-v(4)-v(6))
6326  cheb24(7) = cheb12(7)+alam
6327  cheb24(19) = cheb12(7)-alam
6328  alam = x(10)*v(2)-x(6)*v(4)+x(2)*v(6)
6329  cheb24(11) = cheb12(11)+alam
6330  cheb24(15) = cheb12(11)-alam
6331 
6332  do i=1,3
6333  j = 8-i
6334  v(i) = fval(i)-fval(j)
6335  fval(i) = fval(i)+fval(j)
6336  end do
6337 
6338  cheb12(5) = v(1)+x(8)*v(3)
6339  cheb12(9) = fval(1)-x(8)*fval(3)
6340  alam = x(4)*v(2)
6341  cheb24(5) = cheb12(5)+alam
6342  cheb24(21) = cheb12(5)-alam
6343  alam = x(8)*fval(2)-fval(4)
6344  cheb24(9) = cheb12(9)+alam
6345  cheb24(17) = cheb12(9)-alam
6346  cheb12(1) = fval(1)+fval(3)
6347  alam = fval(2)+fval(4)
6348  cheb24(1) = cheb12(1)+alam
6349  cheb24(25) = cheb12(1)-alam
6350  cheb12(13) = v(1)-v(3)
6351  cheb24(13) = cheb12(13)
6352  alam = 0.1d+01/0.6d+01
6353 
6354  do i=2,12
6355  cheb12(i) = cheb12(i)*alam
6356  end do
6357 
6358  alam = 0.5d+00*alam
6359  cheb12(1) = cheb12(1)*alam
6360  cheb12(13) = cheb12(13)*alam
6361 
6362  do i=2,24
6363  cheb24(i) = cheb24(i)*alam
6364  end do
6365 
6366  cheb24(1) = 0.5d+00*alam*cheb24(1)
6367  cheb24(25) = 0.5d+00*alam*cheb24(25)
6368 
6369  return
6370 end subroutine dqcheb
6371 
6372  !----------------------------------------------------------------------------------------
6440 subroutine dqelg ( n, epstab, result, abserr, res3la, nres )
6442  implicit none
6443 
6444  real ( kind = 8 ) abserr,delta1,delta2,delta3, &
6445  epmach,epsinf,epstab,error,err1,err2,err3,e0,e1,e1abs,e2,e3, &
6446  oflow,res,result,res3la,ss,tol1,tol2,tol3
6447  integer ( kind = 4 ) i,ib,ib2,ie,indx,k1,k2,k3,limexp,n,newelm
6448  integer ( kind = 4 ) nres
6449  integer ( kind = 4 ) num
6450  dimension epstab(52),res3la(3)
6451 
6452  epmach = epsilon( epmach )
6453  oflow = huge( oflow )
6454  nres = nres+1
6455  abserr = oflow
6456  result = epstab(n)
6457  if(n.lt.3) go to 100
6458  limexp = 50
6459  epstab(n+2) = epstab(n)
6460  newelm = (n-1)/2
6461  epstab(n) = oflow
6462  num = n
6463  k1 = n
6464 
6465  do 40 i = 1,newelm
6466 
6467  k2 = k1-1
6468  k3 = k1-2
6469  res = epstab(k1+2)
6470  e0 = epstab(k3)
6471  e1 = epstab(k2)
6472  e2 = res
6473  e1abs = abs( e1)
6474  delta2 = e2-e1
6475  err2 = abs( delta2)
6476  tol2 = max( abs( e2),e1abs)*epmach
6477  delta3 = e1 - e0
6478  err3 = abs( delta3)
6479  tol3 = max( e1abs, abs( e0))*epmach
6480  if(err2.gt.tol2.or.err3.gt.tol3) go to 10
6481  !
6482  ! if e0, e1 and e2 are equal to machine accuracy, convergence is assumed.
6483  !
6484  result = res
6485  abserr = err2+err3
6486  go to 100
6487 10 e3 = epstab(k1)
6488  epstab(k1) = e1
6489  delta1 = e1-e3
6490  err1 = abs( delta1)
6491  tol1 = max( e1abs, abs( e3))*epmach
6492  !
6493  ! if two elements are very close to each other, omit
6494  ! a part of the table by adjusting the value of n
6495  !
6496  if(err1.le.tol1.or.err2.le.tol2.or.err3.le.tol3) go to 20
6497  ss = 0.1d+01/delta1+0.1d+01/delta2-0.1d+01/delta3
6498  epsinf = abs( ss*e1)
6499  !
6500  ! test to detect irregular behaviour in the table, and
6501  ! eventually omit a part of the table adjusting the value
6502  ! of n.
6503  !
6504  if(epsinf.gt.0.1d-03) go to 30
6505 20 n = i+i-1
6506  go to 50
6507  !
6508  ! compute a new element and eventually adjust
6509  ! the value of result.
6510  !
6511 30 res = e1+0.1d+01/ss
6512  epstab(k1) = res
6513  k1 = k1-2
6514  error = err2 + abs( res-e2 ) + err3
6515 
6516  if ( error .le. abserr ) then
6517  abserr = error
6518  result = res
6519  end if
6520 
6521 40 continue
6522  !
6523  ! shift the table.
6524  !
6525 50 if(n.eq.limexp) n = 2*(limexp/2)-1
6526  ib = 1
6527  if((num/2)*2.eq.num) ib = 2
6528  ie = newelm+1
6529  do i=1,ie
6530  ib2 = ib+2
6531  epstab(ib) = epstab(ib2)
6532  ib = ib2
6533  end do
6534  if(num.eq.n) go to 80
6535  indx = num-n+1
6536  do i = 1,n
6537  epstab(i)= epstab(indx)
6538  indx = indx+1
6539  end do
6540 80 if(nres.ge.4) go to 90
6541  res3la(nres) = result
6542  abserr = oflow
6543  go to 100
6544  !
6545  ! compute error estimate
6546  !
6547 90 abserr = abs( result-res3la(3))+ abs( result-res3la(2)) &
6548  + abs( result-res3la(1))
6549  res3la(1) = res3la(2)
6550  res3la(2) = res3la(3)
6551  res3la(3) = result
6552 100 continue
6553 
6554  abserr = max( abserr, 0.5d+01*epmach* abs( result))
6555 
6556  return
6557 end subroutine dqelg
6558 
6559  !----------------------------------------------------------------------------------------
6640 subroutine dqk15(f,a,b,result,abserr,resabs,resasc)
6642  implicit none
6643 
6644  real ( kind = 8 ) a,absc,abserr,b,centr,dhlgth, &
6645  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth,resabs,resasc, &
6646  resg,resk,reskh,result,uflow,wg,wgk,xgk
6647  integer ( kind = 4 ) j,jtw,jtwm1
6648  external f
6649  dimension fv1(7),fv2(7),wg(4),wgk(8),xgk(8)
6650 
6651  data wg( 1) / 0.129484966168869693270611432679082d0 /
6652  data wg( 2) / 0.279705391489276667901467771423780d0 /
6653  data wg( 3) / 0.381830050505118944950369775488975d0 /
6654  data wg( 4) / 0.417959183673469387755102040816327d0 /
6655 
6656  data xgk( 1) / 0.991455371120812639206854697526329d0 /
6657  data xgk( 2) / 0.949107912342758524526189684047851d0 /
6658  data xgk( 3) / 0.864864423359769072789712788640926d0 /
6659  data xgk( 4) / 0.741531185599394439863864773280788d0 /
6660  data xgk( 5) / 0.586087235467691130294144838258730d0 /
6661  data xgk( 6) / 0.405845151377397166906606412076961d0 /
6662  data xgk( 7) / 0.207784955007898467600689403773245d0 /
6663  data xgk( 8) / 0.000000000000000000000000000000000d0 /
6664 
6665  data wgk( 1) / 0.022935322010529224963732008058970d0 /
6666  data wgk( 2) / 0.063092092629978553290700663189204d0 /
6667  data wgk( 3) / 0.104790010322250183839876322541518d0 /
6668  data wgk( 4) / 0.140653259715525918745189590510238d0 /
6669  data wgk( 5) / 0.169004726639267902826583426598550d0 /
6670  data wgk( 6) / 0.190350578064785409913256402421014d0 /
6671  data wgk( 7) / 0.204432940075298892414161999234649d0 /
6672  data wgk( 8) / 0.209482141084727828012999174891714d0 /
6673 
6674  epmach = epsilon( epmach )
6675  uflow = tiny( uflow )
6676  centr = 0.5d+00*(a+b)
6677  hlgth = 0.5d+00*(b-a)
6678  dhlgth = abs( hlgth)
6679  !
6680  ! compute the 15-point kronrod approximation to
6681  ! the integral, and estimate the absolute error.
6682  !
6683  fc = f(centr)
6684  resg = fc*wg(4)
6685  resk = fc*wgk(8)
6686  resabs = abs( resk)
6687 
6688  do j=1,3
6689  jtw = j*2
6690  absc = hlgth*xgk(jtw)
6691  fval1 = f(centr-absc)
6692  fval2 = f(centr+absc)
6693  fv1(jtw) = fval1
6694  fv2(jtw) = fval2
6695  fsum = fval1+fval2
6696  resg = resg+wg(j)*fsum
6697  resk = resk+wgk(jtw)*fsum
6698  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
6699  end do
6700 
6701  do j = 1,4
6702  jtwm1 = j*2-1
6703  absc = hlgth*xgk(jtwm1)
6704  fval1 = f(centr-absc)
6705  fval2 = f(centr+absc)
6706  fv1(jtwm1) = fval1
6707  fv2(jtwm1) = fval2
6708  fsum = fval1+fval2
6709  resk = resk+wgk(jtwm1)*fsum
6710  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
6711  end do
6712 
6713  reskh = resk*0.5d+00
6714  resasc = wgk(8)* abs( fc-reskh)
6715  do j=1,7
6716  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
6717  end do
6718 
6719  result = resk*hlgth
6720  resabs = resabs*dhlgth
6721  resasc = resasc*dhlgth
6722  abserr = abs( (resk-resg)*hlgth)
6723  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) &
6724  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
6725  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
6726  ((epmach*0.5d+02)*resabs,abserr)
6727 
6728  return
6729 end subroutine dqk15
6730 
6731  !----------------------------------------------------------------------------------------
6831 subroutine dqk15i(f,boun,inf,a,b,result,abserr,resabs,resasc)
6833  implicit none
6834 
6835  real ( kind = 8 ) a,absc,absc1,absc2,abserr,b,boun,centr,dinf, &
6836  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth, &
6837  resabs,resasc,resg,resk,reskh,result,tabsc1,tabsc2,uflow,wg,wgk, &
6838  xgk
6839  integer ( kind = 4 ) inf,j
6840  external f
6841  dimension fv1(7),fv2(7),xgk(8),wgk(8),wg(8)
6842 
6843  data wg(1) / 0.0d0 /
6844  data wg(2) / 0.129484966168869693270611432679082d0 /
6845  data wg(3) / 0.0d0 /
6846  data wg(4) / 0.279705391489276667901467771423780d0 /
6847  data wg(5) / 0.0d0 /
6848  data wg(6) / 0.381830050505118944950369775488975d0 /
6849  data wg(7) / 0.0d0 /
6850  data wg(8) / 0.417959183673469387755102040816327d0 /
6851 
6852  data xgk(1) / 0.991455371120812639206854697526329d0 /
6853  data xgk(2) / 0.949107912342758524526189684047851d0 /
6854  data xgk(3) / 0.864864423359769072789712788640926d0 /
6855  data xgk(4) / 0.741531185599394439863864773280788d0 /
6856  data xgk(5) / 0.586087235467691130294144838258730d0 /
6857  data xgk(6) / 0.405845151377397166906606412076961d0 /
6858  data xgk(7) / 0.207784955007898467600689403773245d0 /
6859  data xgk(8) / 0.000000000000000000000000000000000d0 /
6860 
6861  data wgk(1) / 0.022935322010529224963732008058970d0 /
6862  data wgk(2) / 0.063092092629978553290700663189204d0 /
6863  data wgk(3) / 0.104790010322250183839876322541518d0 /
6864  data wgk(4) / 0.140653259715525918745189590510238d0 /
6865  data wgk(5) / 0.169004726639267902826583426598550d0 /
6866  data wgk(6) / 0.190350578064785409913256402421014d0 /
6867  data wgk(7) / 0.204432940075298892414161999234649d0 /
6868  data wgk(8) / 0.209482141084727828012999174891714d0 /
6869 
6870  epmach = epsilon( epmach )
6871  uflow = tiny( uflow )
6872  dinf = min( 1, inf )
6873  centr = 0.5d+00*(a+b)
6874  hlgth = 0.5d+00*(b-a)
6875  tabsc1 = boun+dinf*(0.1d+01-centr)/centr
6876  fval1 = f(tabsc1)
6877  if(inf.eq.2) fval1 = fval1+f(-tabsc1)
6878  fc = (fval1/centr)/centr
6879  !
6880  ! compute the 15-point kronrod approximation to
6881  ! the integral, and estimate the error.
6882  !
6883  resg = wg(8)*fc
6884  resk = wgk(8)*fc
6885  resabs = abs( resk)
6886 
6887  do j=1,7
6888  absc = hlgth*xgk(j)
6889  absc1 = centr-absc
6890  absc2 = centr+absc
6891  tabsc1 = boun+dinf*(0.1d+01-absc1)/absc1
6892  tabsc2 = boun+dinf*(0.1d+01-absc2)/absc2
6893  fval1 = f(tabsc1)
6894  fval2 = f(tabsc2)
6895  if(inf.eq.2) fval1 = fval1+f(-tabsc1)
6896  if(inf.eq.2) fval2 = fval2+f(-tabsc2)
6897  fval1 = (fval1/absc1)/absc1
6898  fval2 = (fval2/absc2)/absc2
6899  fv1(j) = fval1
6900  fv2(j) = fval2
6901  fsum = fval1+fval2
6902  resg = resg+wg(j)*fsum
6903  resk = resk+wgk(j)*fsum
6904  resabs = resabs+wgk(j)*( abs( fval1)+ abs( fval2))
6905  end do
6906 
6907  reskh = resk*0.5d+00
6908  resasc = wgk(8)* abs( fc-reskh)
6909 
6910  do j=1,7
6911  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
6912  end do
6913 
6914  result = resk*hlgth
6915  resasc = resasc*hlgth
6916  resabs = resabs*hlgth
6917  abserr = abs( (resk-resg)*hlgth)
6918  if(resasc.ne.0.0d+00.and.abserr.ne.0.d0) abserr = resasc* &
6919  min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
6920  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
6921  ((epmach*0.5d+02)*resabs,abserr)
6922 
6923  return
6924 end subroutine dqk15i
6925 
6926  !----------------------------------------------------------------------------------------
7014 subroutine dqk15w(f,w,p1,p2,p3,p4,kp,a,b,result,abserr, resabs,resasc)
7016  implicit none
7017 
7018  real ( kind = 8 ) a,absc,absc1,absc2,abserr,b,centr,dhlgth, &
7019  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth, &
7020  p1,p2,p3,p4,resabs,resasc,resg,resk,reskh,result,uflow,w,wg,wgk, &
7021  xgk
7022  integer ( kind = 4 ) j,jtw,jtwm1,kp
7023  external f,w
7024 
7025  dimension fv1(7),fv2(7),xgk(8),wgk(8),wg(4)
7026 
7027  data xgk(1),xgk(2),xgk(3),xgk(4),xgk(5),xgk(6),xgk(7),xgk(8)/ &
7028  0.9914553711208126d+00, 0.9491079123427585d+00, &
7029  0.8648644233597691d+00, 0.7415311855993944d+00, &
7030  0.5860872354676911d+00, 0.4058451513773972d+00, &
7031  0.2077849550078985d+00, 0.0000000000000000d+00/
7032 
7033  data wgk(1),wgk(2),wgk(3),wgk(4),wgk(5),wgk(6),wgk(7),wgk(8)/ &
7034  0.2293532201052922d-01, 0.6309209262997855d-01, &
7035  0.1047900103222502d+00, 0.1406532597155259d+00, &
7036  0.1690047266392679d+00, 0.1903505780647854d+00, &
7037  0.2044329400752989d+00, 0.2094821410847278d+00/
7038 
7039  data wg(1),wg(2),wg(3),wg(4)/ &
7040  0.1294849661688697d+00, 0.2797053914892767d+00, &
7041  0.3818300505051889d+00, 0.4179591836734694d+00/
7042 
7043  epmach = epsilon( epmach )
7044  uflow = tiny( uflow )
7045  centr = 0.5d+00*(a+b)
7046  hlgth = 0.5d+00*(b-a)
7047  dhlgth = abs( hlgth)
7048  !
7049  ! compute the 15-point kronrod approximation to the
7050  ! integral, and estimate the error.
7051  !
7052  fc = f(centr)*w(centr,p1,p2,p3,p4,kp)
7053  resg = wg(4)*fc
7054  resk = wgk(8)*fc
7055  resabs = abs( resk)
7056 
7057  do j=1,3
7058  jtw = j*2
7059  absc = hlgth*xgk(jtw)
7060  absc1 = centr-absc
7061  absc2 = centr+absc
7062  fval1 = f(absc1)*w(absc1,p1,p2,p3,p4,kp)
7063  fval2 = f(absc2)*w(absc2,p1,p2,p3,p4,kp)
7064  fv1(jtw) = fval1
7065  fv2(jtw) = fval2
7066  fsum = fval1+fval2
7067  resg = resg+wg(j)*fsum
7068  resk = resk+wgk(jtw)*fsum
7069  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
7070  end do
7071 
7072  do j=1,4
7073  jtwm1 = j*2-1
7074  absc = hlgth*xgk(jtwm1)
7075  absc1 = centr-absc
7076  absc2 = centr+absc
7077  fval1 = f(absc1)*w(absc1,p1,p2,p3,p4,kp)
7078  fval2 = f(absc2)*w(absc2,p1,p2,p3,p4,kp)
7079  fv1(jtwm1) = fval1
7080  fv2(jtwm1) = fval2
7081  fsum = fval1+fval2
7082  resk = resk+wgk(jtwm1)*fsum
7083  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
7084  end do
7085 
7086  reskh = resk*0.5d+00
7087  resasc = wgk(8)* abs( fc-reskh)
7088 
7089  do j=1,7
7090  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
7091  end do
7092 
7093  result = resk*hlgth
7094  resabs = resabs*dhlgth
7095  resasc = resasc*dhlgth
7096  abserr = abs( (resk-resg)*hlgth)
7097  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) &
7098  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
7099  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max( (epmach* &
7100  0.5d+02)*resabs,abserr)
7101 
7102  return
7103 end subroutine dqk15w
7104 
7105  !----------------------------------------------------------------------------------------
7189 subroutine dqk21(f,a,b,result,abserr,resabs,resasc)
7191  implicit none
7192 
7193  real ( kind = 8 ) a,absc,abserr,b,centr,dhlgth, &
7194  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth,resabs,resasc, &
7195  resg,resk,reskh,result,uflow,wg,wgk,xgk
7196  integer ( kind = 4 ) j,jtw,jtwm1
7197  external f
7198  dimension fv1(10),fv2(10),wg(5),wgk(11),xgk(11)
7199 
7200  data wg( 1) / 0.066671344308688137593568809893332d0 /
7201  data wg( 2) / 0.149451349150580593145776339657697d0 /
7202  data wg( 3) / 0.219086362515982043995534934228163d0 /
7203  data wg( 4) / 0.269266719309996355091226921569469d0 /
7204  data wg( 5) / 0.295524224714752870173892994651338d0 /
7205 
7206  data xgk( 1) / 0.995657163025808080735527280689003d0 /
7207  data xgk( 2) / 0.973906528517171720077964012084452d0 /
7208  data xgk( 3) / 0.930157491355708226001207180059508d0 /
7209  data xgk( 4) / 0.865063366688984510732096688423493d0 /
7210  data xgk( 5) / 0.780817726586416897063717578345042d0 /
7211  data xgk( 6) / 0.679409568299024406234327365114874d0 /
7212  data xgk( 7) / 0.562757134668604683339000099272694d0 /
7213  data xgk( 8) / 0.433395394129247190799265943165784d0 /
7214  data xgk( 9) / 0.294392862701460198131126603103866d0 /
7215  data xgk( 10) / 0.148874338981631210884826001129720d0 /
7216  data xgk( 11) / 0.000000000000000000000000000000000d0 /
7217 
7218  data wgk( 1) / 0.011694638867371874278064396062192d0 /
7219  data wgk( 2) / 0.032558162307964727478818972459390d0 /
7220  data wgk( 3) / 0.054755896574351996031381300244580d0 /
7221  data wgk( 4) / 0.075039674810919952767043140916190d0 /
7222  data wgk( 5) / 0.093125454583697605535065465083366d0 /
7223  data wgk( 6) / 0.109387158802297641899210590325805d0 /
7224  data wgk( 7) / 0.123491976262065851077958109831074d0 /
7225  data wgk( 8) / 0.134709217311473325928054001771707d0 /
7226  data wgk( 9) / 0.142775938577060080797094273138717d0 /
7227  data wgk( 10) / 0.147739104901338491374841515972068d0 /
7228  data wgk( 11) / 0.149445554002916905664936468389821d0 /
7229 
7230  epmach = epsilon( epmach )
7231  uflow = tiny( uflow )
7232  centr = 0.5d+00*(a+b)
7233  hlgth = 0.5d+00*(b-a)
7234  dhlgth = abs( hlgth)
7235  !
7236  ! compute the 21-point kronrod approximation to
7237  ! the integral, and estimate the absolute error.
7238  !
7239  resg = 0.0d+00
7240  fc = f(centr)
7241  resk = wgk(11)*fc
7242  resabs = abs( resk)
7243  do j=1,5
7244  jtw = 2*j
7245  absc = hlgth*xgk(jtw)
7246  fval1 = f(centr-absc)
7247  fval2 = f(centr+absc)
7248  fv1(jtw) = fval1
7249  fv2(jtw) = fval2
7250  fsum = fval1+fval2
7251  resg = resg+wg(j)*fsum
7252  resk = resk+wgk(jtw)*fsum
7253  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
7254  end do
7255 
7256  do j = 1,5
7257  jtwm1 = 2*j-1
7258  absc = hlgth*xgk(jtwm1)
7259  fval1 = f(centr-absc)
7260  fval2 = f(centr+absc)
7261  fv1(jtwm1) = fval1
7262  fv2(jtwm1) = fval2
7263  fsum = fval1+fval2
7264  resk = resk+wgk(jtwm1)*fsum
7265  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
7266  end do
7267 
7268  reskh = resk*0.5d+00
7269  resasc = wgk(11)* abs( fc-reskh)
7270 
7271  do j=1,10
7272  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
7273  end do
7274 
7275  result = resk*hlgth
7276  resabs = resabs*dhlgth
7277  resasc = resasc*dhlgth
7278  abserr = abs( (resk-resg)*hlgth)
7279  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) &
7280  abserr = resasc*min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
7281  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
7282  ((epmach*0.5d+02)*resabs,abserr)
7283 
7284  return
7285 end subroutine dqk21
7286 
7287  !----------------------------------------------------------------------------------------
7371 subroutine dqk31(f,a,b,result,abserr,resabs,resasc)
7373  implicit none
7374 
7375  real ( kind = 8 ) a,absc,abserr,b,centr,dhlgth, &
7376  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth,resabs,resasc, &
7377  resg,resk,reskh,result,uflow,wg,wgk,xgk
7378  integer ( kind = 4 ) j,jtw,jtwm1
7379  external f
7380 
7381  dimension fv1(15),fv2(15),xgk(16),wgk(16),wg(8)
7382 
7383  data wg( 1) / 0.030753241996117268354628393577204d0 /
7384  data wg( 2) / 0.070366047488108124709267416450667d0 /
7385  data wg( 3) / 0.107159220467171935011869546685869d0 /
7386  data wg( 4) / 0.139570677926154314447804794511028d0 /
7387  data wg( 5) / 0.166269205816993933553200860481209d0 /
7388  data wg( 6) / 0.186161000015562211026800561866423d0 /
7389  data wg( 7) / 0.198431485327111576456118326443839d0 /
7390  data wg( 8) / 0.202578241925561272880620199967519d0 /
7391 
7392  data xgk( 1) / 0.998002298693397060285172840152271d0 /
7393  data xgk( 2) / 0.987992518020485428489565718586613d0 /
7394  data xgk( 3) / 0.967739075679139134257347978784337d0 /
7395  data xgk( 4) / 0.937273392400705904307758947710209d0 /
7396  data xgk( 5) / 0.897264532344081900882509656454496d0 /
7397  data xgk( 6) / 0.848206583410427216200648320774217d0 /
7398  data xgk( 7) / 0.790418501442465932967649294817947d0 /
7399  data xgk( 8) / 0.724417731360170047416186054613938d0 /
7400  data xgk( 9) / 0.650996741297416970533735895313275d0 /
7401  data xgk( 10) / 0.570972172608538847537226737253911d0 /
7402  data xgk( 11) / 0.485081863640239680693655740232351d0 /
7403  data xgk( 12) / 0.394151347077563369897207370981045d0 /
7404  data xgk( 13) / 0.299180007153168812166780024266389d0 /
7405  data xgk( 14) / 0.201194093997434522300628303394596d0 /
7406  data xgk( 15) / 0.101142066918717499027074231447392d0 /
7407  data xgk( 16) / 0.000000000000000000000000000000000d0 /
7408 
7409  data wgk( 1) / 0.005377479872923348987792051430128d0 /
7410  data wgk( 2) / 0.015007947329316122538374763075807d0 /
7411  data wgk( 3) / 0.025460847326715320186874001019653d0 /
7412  data wgk( 4) / 0.035346360791375846222037948478360d0 /
7413  data wgk( 5) / 0.044589751324764876608227299373280d0 /
7414  data wgk( 6) / 0.053481524690928087265343147239430d0 /
7415  data wgk( 7) / 0.062009567800670640285139230960803d0 /
7416  data wgk( 8) / 0.069854121318728258709520077099147d0 /
7417  data wgk( 9) / 0.076849680757720378894432777482659d0 /
7418  data wgk( 10) / 0.083080502823133021038289247286104d0 /
7419  data wgk( 11) / 0.088564443056211770647275443693774d0 /
7420  data wgk( 12) / 0.093126598170825321225486872747346d0 /
7421  data wgk( 13) / 0.096642726983623678505179907627589d0 /
7422  data wgk( 14) / 0.099173598721791959332393173484603d0 /
7423  data wgk( 15) / 0.100769845523875595044946662617570d0 /
7424  data wgk( 16) / 0.101330007014791549017374792767493d0 /
7425 
7426  epmach = epsilon( epmach )
7427  uflow = tiny( uflow )
7428  centr = 0.5d+00*(a+b)
7429  hlgth = 0.5d+00*(b-a)
7430  dhlgth = abs( hlgth)
7431  !
7432  ! compute the 31-point kronrod approximation to
7433  ! the integral, and estimate the absolute error.
7434  !
7435  fc = f(centr)
7436  resg = wg(8)*fc
7437  resk = wgk(16)*fc
7438  resabs = abs( resk)
7439 
7440  do j=1,7
7441  jtw = j*2
7442  absc = hlgth*xgk(jtw)
7443  fval1 = f(centr-absc)
7444  fval2 = f(centr+absc)
7445  fv1(jtw) = fval1
7446  fv2(jtw) = fval2
7447  fsum = fval1+fval2
7448  resg = resg+wg(j)*fsum
7449  resk = resk+wgk(jtw)*fsum
7450  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
7451  end do
7452 
7453  do j = 1,8
7454  jtwm1 = j*2-1
7455  absc = hlgth*xgk(jtwm1)
7456  fval1 = f(centr-absc)
7457  fval2 = f(centr+absc)
7458  fv1(jtwm1) = fval1
7459  fv2(jtwm1) = fval2
7460  fsum = fval1+fval2
7461  resk = resk+wgk(jtwm1)*fsum
7462  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
7463  end do
7464 
7465  reskh = resk*0.5d+00
7466  resasc = wgk(16)* abs( fc-reskh)
7467 
7468  do j=1,15
7469  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
7470  end do
7471 
7472  result = resk*hlgth
7473  resabs = resabs*dhlgth
7474  resasc = resasc*dhlgth
7475  abserr = abs( (resk-resg)*hlgth)
7476  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) &
7477  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
7478  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
7479  ((epmach*0.5d+02)*resabs,abserr)
7480 
7481  return
7482 end subroutine dqk31
7483 
7484  !----------------------------------------------------------------------------------------
7568 subroutine dqk41 ( f, a, b, result, abserr, resabs, resasc )
7570  implicit none
7571 
7572  real ( kind = 8 ) a,absc,abserr,b,centr,dhlgth, &
7573  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth,resabs,resasc, &
7574  resg,resk,reskh,result,uflow,wg,wgk,xgk
7575  integer ( kind = 4 ) j,jtw,jtwm1
7576  external f
7577 
7578  dimension fv1(20),fv2(20),xgk(21),wgk(21),wg(10)
7579 
7580  data wg( 1) / 0.017614007139152118311861962351853d0 /
7581  data wg( 2) / 0.040601429800386941331039952274932d0 /
7582  data wg( 3) / 0.062672048334109063569506535187042d0 /
7583  data wg( 4) / 0.083276741576704748724758143222046d0 /
7584  data wg( 5) / 0.101930119817240435036750135480350d0 /
7585  data wg( 6) / 0.118194531961518417312377377711382d0 /
7586  data wg( 7) / 0.131688638449176626898494499748163d0 /
7587  data wg( 8) / 0.142096109318382051329298325067165d0 /
7588  data wg( 9) / 0.149172986472603746787828737001969d0 /
7589  data wg( 10) / 0.152753387130725850698084331955098d0 /
7590 
7591  data xgk( 1) / 0.998859031588277663838315576545863d0 /
7592  data xgk( 2) / 0.993128599185094924786122388471320d0 /
7593  data xgk( 3) / 0.981507877450250259193342994720217d0 /
7594  data xgk( 4) / 0.963971927277913791267666131197277d0 /
7595  data xgk( 5) / 0.940822633831754753519982722212443d0 /
7596  data xgk( 6) / 0.912234428251325905867752441203298d0 /
7597  data xgk( 7) / 0.878276811252281976077442995113078d0 /
7598  data xgk( 8) / 0.839116971822218823394529061701521d0 /
7599  data xgk( 9) / 0.795041428837551198350638833272788d0 /
7600  data xgk( 10) / 0.746331906460150792614305070355642d0 /
7601  data xgk( 11) / 0.693237656334751384805490711845932d0 /
7602  data xgk( 12) / 0.636053680726515025452836696226286d0 /
7603  data xgk( 13) / 0.575140446819710315342946036586425d0 /
7604  data xgk( 14) / 0.510867001950827098004364050955251d0 /
7605  data xgk( 15) / 0.443593175238725103199992213492640d0 /
7606  data xgk( 16) / 0.373706088715419560672548177024927d0 /
7607  data xgk( 17) / 0.301627868114913004320555356858592d0 /
7608  data xgk( 18) / 0.227785851141645078080496195368575d0 /
7609  data xgk( 19) / 0.152605465240922675505220241022678d0 /
7610  data xgk( 20) / 0.076526521133497333754640409398838d0 /
7611  data xgk( 21) / 0.000000000000000000000000000000000d0 /
7612 
7613  data wgk( 1) / 0.003073583718520531501218293246031d0 /
7614  data wgk( 2) / 0.008600269855642942198661787950102d0 /
7615  data wgk( 3) / 0.014626169256971252983787960308868d0 /
7616  data wgk( 4) / 0.020388373461266523598010231432755d0 /
7617  data wgk( 5) / 0.025882133604951158834505067096153d0 /
7618  data wgk( 6) / 0.031287306777032798958543119323801d0 /
7619  data wgk( 7) / 0.036600169758200798030557240707211d0 /
7620  data wgk( 8) / 0.041668873327973686263788305936895d0 /
7621  data wgk( 9) / 0.046434821867497674720231880926108d0 /
7622  data wgk( 10) / 0.050944573923728691932707670050345d0 /
7623  data wgk( 11) / 0.055195105348285994744832372419777d0 /
7624  data wgk( 12) / 0.059111400880639572374967220648594d0 /
7625  data wgk( 13) / 0.062653237554781168025870122174255d0 /
7626  data wgk( 14) / 0.065834597133618422111563556969398d0 /
7627  data wgk( 15) / 0.068648672928521619345623411885368d0 /
7628  data wgk( 16) / 0.071054423553444068305790361723210d0 /
7629  data wgk( 17) / 0.073030690332786667495189417658913d0 /
7630  data wgk( 18) / 0.074582875400499188986581418362488d0 /
7631  data wgk( 19) / 0.075704497684556674659542775376617d0 /
7632  data wgk( 20) / 0.076377867672080736705502835038061d0 /
7633  data wgk( 21) / 0.076600711917999656445049901530102d0 /
7634 
7635  epmach = epsilon( epmach )
7636  uflow = tiny( uflow )
7637  centr = 0.5d+00*(a+b)
7638  hlgth = 0.5d+00*(b-a)
7639  dhlgth = abs( hlgth)
7640  !
7641  ! compute the 41-point gauss-kronrod approximation to
7642  ! the integral, and estimate the absolute error.
7643  !
7644  resg = 0.0d+00
7645  fc = f(centr)
7646  resk = wgk(21)*fc
7647  resabs = abs( resk)
7648 
7649  do j=1,10
7650  jtw = j*2
7651  absc = hlgth*xgk(jtw)
7652  fval1 = f(centr-absc)
7653  fval2 = f(centr+absc)
7654  fv1(jtw) = fval1
7655  fv2(jtw) = fval2
7656  fsum = fval1+fval2
7657  resg = resg+wg(j)*fsum
7658  resk = resk+wgk(jtw)*fsum
7659  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
7660  end do
7661 
7662  do j = 1,10
7663  jtwm1 = j*2-1
7664  absc = hlgth*xgk(jtwm1)
7665  fval1 = f(centr-absc)
7666  fval2 = f(centr+absc)
7667  fv1(jtwm1) = fval1
7668  fv2(jtwm1) = fval2
7669  fsum = fval1+fval2
7670  resk = resk+wgk(jtwm1)*fsum
7671  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
7672  end do
7673 
7674  reskh = resk*0.5d+00
7675  resasc = wgk(21)* abs( fc-reskh)
7676 
7677  do j=1,20
7678  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
7679  end do
7680 
7681  result = resk*hlgth
7682  resabs = resabs*dhlgth
7683  resasc = resasc*dhlgth
7684  abserr = abs( (resk-resg)*hlgth)
7685  if(resasc.ne.0.0d+00.and.abserr.ne.0.d+00) &
7686  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
7687  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
7688  ((epmach*0.5d+02)*resabs,abserr)
7689 
7690  return
7691 end subroutine dqk41
7692 
7693  !----------------------------------------------------------------------------------------
7774 subroutine dqk51(f,a,b,result,abserr,resabs,resasc)
7776  implicit none
7777 
7778  real ( kind = 8 ) a,absc,abserr,b,centr,dhlgth, &
7779  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth,resabs,resasc, &
7780  resg,resk,reskh,result,uflow,wg,wgk,xgk
7781  integer ( kind = 4 ) j,jtw,jtwm1
7782  external f
7783 
7784  dimension fv1(25),fv2(25),xgk(26),wgk(26),wg(13)
7785 
7786  data wg( 1) / 0.011393798501026287947902964113235d0 /
7787  data wg( 2) / 0.026354986615032137261901815295299d0 /
7788  data wg( 3) / 0.040939156701306312655623487711646d0 /
7789  data wg( 4) / 0.054904695975835191925936891540473d0 /
7790  data wg( 5) / 0.068038333812356917207187185656708d0 /
7791  data wg( 6) / 0.080140700335001018013234959669111d0 /
7792  data wg( 7) / 0.091028261982963649811497220702892d0 /
7793  data wg( 8) / 0.100535949067050644202206890392686d0 /
7794  data wg( 9) / 0.108519624474263653116093957050117d0 /
7795  data wg( 10) / 0.114858259145711648339325545869556d0 /
7796  data wg( 11) / 0.119455763535784772228178126512901d0 /
7797  data wg( 12) / 0.122242442990310041688959518945852d0 /
7798  data wg( 13) / 0.123176053726715451203902873079050d0 /
7799 
7800  data xgk( 1) / 0.999262104992609834193457486540341d0 /
7801  data xgk( 2) / 0.995556969790498097908784946893902d0 /
7802  data xgk( 3) / 0.988035794534077247637331014577406d0 /
7803  data xgk( 4) / 0.976663921459517511498315386479594d0 /
7804  data xgk( 5) / 0.961614986425842512418130033660167d0 /
7805  data xgk( 6) / 0.942974571228974339414011169658471d0 /
7806  data xgk( 7) / 0.920747115281701561746346084546331d0 /
7807  data xgk( 8) / 0.894991997878275368851042006782805d0 /
7808  data xgk( 9) / 0.865847065293275595448996969588340d0 /
7809  data xgk( 10) / 0.833442628760834001421021108693570d0 /
7810  data xgk( 11) / 0.797873797998500059410410904994307d0 /
7811  data xgk( 12) / 0.759259263037357630577282865204361d0 /
7812  data xgk( 13) / 0.717766406813084388186654079773298d0 /
7813  data xgk( 14) / 0.673566368473468364485120633247622d0 /
7814  data xgk( 15) / 0.626810099010317412788122681624518d0 /
7815  data xgk( 16) / 0.577662930241222967723689841612654d0 /
7816  data xgk( 17) / 0.526325284334719182599623778158010d0 /
7817  data xgk( 18) / 0.473002731445714960522182115009192d0 /
7818  data xgk( 19) / 0.417885382193037748851814394594572d0 /
7819  data xgk( 20) / 0.361172305809387837735821730127641d0 /
7820  data xgk( 21) / 0.303089538931107830167478909980339d0 /
7821  data xgk( 22) / 0.243866883720988432045190362797452d0 /
7822  data xgk( 23) / 0.183718939421048892015969888759528d0 /
7823  data xgk( 24) / 0.122864692610710396387359818808037d0 /
7824  data xgk( 25) / 0.061544483005685078886546392366797d0 /
7825  data xgk( 26) / 0.000000000000000000000000000000000d0 /
7826 
7827  data wgk( 1) / 0.001987383892330315926507851882843d0 /
7828  data wgk( 2) / 0.005561932135356713758040236901066d0 /
7829  data wgk( 3) / 0.009473973386174151607207710523655d0 /
7830  data wgk( 4) / 0.013236229195571674813656405846976d0 /
7831  data wgk( 5) / 0.016847817709128298231516667536336d0 /
7832  data wgk( 6) / 0.020435371145882835456568292235939d0 /
7833  data wgk( 7) / 0.024009945606953216220092489164881d0 /
7834  data wgk( 8) / 0.027475317587851737802948455517811d0 /
7835  data wgk( 9) / 0.030792300167387488891109020215229d0 /
7836  data wgk( 10) / 0.034002130274329337836748795229551d0 /
7837  data wgk( 11) / 0.037116271483415543560330625367620d0 /
7838  data wgk( 12) / 0.040083825504032382074839284467076d0 /
7839  data wgk( 13) / 0.042872845020170049476895792439495d0 /
7840  data wgk( 14) / 0.045502913049921788909870584752660d0 /
7841  data wgk( 15) / 0.047982537138836713906392255756915d0 /
7842  data wgk( 16) / 0.050277679080715671963325259433440d0 /
7843  data wgk( 17) / 0.052362885806407475864366712137873d0 /
7844  data wgk( 18) / 0.054251129888545490144543370459876d0 /
7845  data wgk( 19) / 0.055950811220412317308240686382747d0 /
7846  data wgk( 20) / 0.057437116361567832853582693939506d0 /
7847  data wgk( 21) / 0.058689680022394207961974175856788d0 /
7848  data wgk( 22) / 0.059720340324174059979099291932562d0 /
7849  data wgk( 23) / 0.060539455376045862945360267517565d0 /
7850  data wgk( 24) / 0.061128509717053048305859030416293d0 /
7851  data wgk( 25) / 0.061471189871425316661544131965264d0 /
7852  data wgk( 26) / 0.061580818067832935078759824240066d0 /
7853 
7854  epmach = epsilon( epmach )
7855  uflow = tiny( uflow )
7856  centr = 0.5d+00*(a+b)
7857  hlgth = 0.5d+00*(b-a)
7858  dhlgth = abs( hlgth)
7859  !
7860  ! compute the 51-point kronrod approximation to
7861  ! the integral, and estimate the absolute error.
7862  !
7863  fc = f(centr)
7864  resg = wg(13)*fc
7865  resk = wgk(26)*fc
7866  resabs = abs( resk)
7867 
7868  do j=1,12
7869  jtw = j*2
7870  absc = hlgth*xgk(jtw)
7871  fval1 = f(centr-absc)
7872  fval2 = f(centr+absc)
7873  fv1(jtw) = fval1
7874  fv2(jtw) = fval2
7875  fsum = fval1+fval2
7876  resg = resg+wg(j)*fsum
7877  resk = resk+wgk(jtw)*fsum
7878  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
7879  end do
7880 
7881  do j = 1,13
7882  jtwm1 = j*2-1
7883  absc = hlgth*xgk(jtwm1)
7884  fval1 = f(centr-absc)
7885  fval2 = f(centr+absc)
7886  fv1(jtwm1) = fval1
7887  fv2(jtwm1) = fval2
7888  fsum = fval1+fval2
7889  resk = resk+wgk(jtwm1)*fsum
7890  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
7891  end do
7892 
7893  reskh = resk*0.5d+00
7894  resasc = wgk(26)* abs( fc-reskh)
7895 
7896  do j=1,25
7897  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
7898  end do
7899 
7900  result = resk*hlgth
7901  resabs = resabs*dhlgth
7902  resasc = resasc*dhlgth
7903  abserr = abs( (resk-resg)*hlgth)
7904  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) &
7905  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
7906  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
7907  ((epmach*0.5d+02)*resabs,abserr)
7908 
7909  return
7910 end subroutine dqk51
7911 
7912  !----------------------------------------------------------------------------------------
7993 subroutine dqk61(f,a,b,result,abserr,resabs,resasc)
7995  implicit none
7996 
7997  real ( kind = 8 ) a,dabsc,abserr,b,centr,dhlgth, &
7998  epmach,f,fc,fsum,fval1,fval2,fv1,fv2,hlgth,resabs,resasc, &
7999  resg,resk,reskh,result,uflow,wg,wgk,xgk
8000  integer ( kind = 4 ) j,jtw,jtwm1
8001  external f
8002 
8003  dimension fv1(30),fv2(30),xgk(31),wgk(31),wg(15)
8004 
8005  data wg( 1) / 0.007968192496166605615465883474674d0 /
8006  data wg( 2) / 0.018466468311090959142302131912047d0 /
8007  data wg( 3) / 0.028784707883323369349719179611292d0 /
8008  data wg( 4) / 0.038799192569627049596801936446348d0 /
8009  data wg( 5) / 0.048402672830594052902938140422808d0 /
8010  data wg( 6) / 0.057493156217619066481721689402056d0 /
8011  data wg( 7) / 0.065974229882180495128128515115962d0 /
8012  data wg( 8) / 0.073755974737705206268243850022191d0 /
8013  data wg( 9) / 0.080755895229420215354694938460530d0 /
8014  data wg( 10) / 0.086899787201082979802387530715126d0 /
8015  data wg( 11) / 0.092122522237786128717632707087619d0 /
8016  data wg( 12) / 0.096368737174644259639468626351810d0 /
8017  data wg( 13) / 0.099593420586795267062780282103569d0 /
8018  data wg( 14) / 0.101762389748405504596428952168554d0 /
8019  data wg( 15) / 0.102852652893558840341285636705415d0 /
8020 
8021  data xgk( 1) / 0.999484410050490637571325895705811d0 /
8022  data xgk( 2) / 0.996893484074649540271630050918695d0 /
8023  data xgk( 3) / 0.991630996870404594858628366109486d0 /
8024  data xgk( 4) / 0.983668123279747209970032581605663d0 /
8025  data xgk( 5) / 0.973116322501126268374693868423707d0 /
8026  data xgk( 6) / 0.960021864968307512216871025581798d0 /
8027  data xgk( 7) / 0.944374444748559979415831324037439d0 /
8028  data xgk( 8) / 0.926200047429274325879324277080474d0 /
8029  data xgk( 9) / 0.905573307699907798546522558925958d0 /
8030  data xgk( 10) / 0.882560535792052681543116462530226d0 /
8031  data xgk( 11) / 0.857205233546061098958658510658944d0 /
8032  data xgk( 12) / 0.829565762382768397442898119732502d0 /
8033  data xgk( 13) / 0.799727835821839083013668942322683d0 /
8034  data xgk( 14) / 0.767777432104826194917977340974503d0 /
8035  data xgk( 15) / 0.733790062453226804726171131369528d0 /
8036  data xgk( 16) / 0.697850494793315796932292388026640d0 /
8037  data xgk( 17) / 0.660061064126626961370053668149271d0 /
8038  data xgk( 18) / 0.620526182989242861140477556431189d0 /
8039  data xgk( 19) / 0.579345235826361691756024932172540d0 /
8040  data xgk( 20) / 0.536624148142019899264169793311073d0 /
8041  data xgk( 21) / 0.492480467861778574993693061207709d0 /
8042  data xgk( 22) / 0.447033769538089176780609900322854d0 /
8043  data xgk( 23) / 0.400401254830394392535476211542661d0 /
8044  data xgk( 24) / 0.352704725530878113471037207089374d0 /
8045  data xgk( 25) / 0.304073202273625077372677107199257d0 /
8046  data xgk( 26) / 0.254636926167889846439805129817805d0 /
8047  data xgk( 27) / 0.204525116682309891438957671002025d0 /
8048  data xgk( 28) / 0.153869913608583546963794672743256d0 /
8049  data xgk( 29) / 0.102806937966737030147096751318001d0 /
8050  data xgk( 30) / 0.051471842555317695833025213166723d0 /
8051  data xgk( 31) / 0.000000000000000000000000000000000d0 /
8052 
8053  data wgk( 1) / 0.001389013698677007624551591226760d0 /
8054  data wgk( 2) / 0.003890461127099884051267201844516d0 /
8055  data wgk( 3) / 0.006630703915931292173319826369750d0 /
8056  data wgk( 4) / 0.009273279659517763428441146892024d0 /
8057  data wgk( 5) / 0.011823015253496341742232898853251d0 /
8058  data wgk( 6) / 0.014369729507045804812451432443580d0 /
8059  data wgk( 7) / 0.016920889189053272627572289420322d0 /
8060  data wgk( 8) / 0.019414141193942381173408951050128d0 /
8061  data wgk( 9) / 0.021828035821609192297167485738339d0 /
8062  data wgk( 10) / 0.024191162078080601365686370725232d0 /
8063  data wgk( 11) / 0.026509954882333101610601709335075d0 /
8064  data wgk( 12) / 0.028754048765041292843978785354334d0 /
8065  data wgk( 13) / 0.030907257562387762472884252943092d0 /
8066  data wgk( 14) / 0.032981447057483726031814191016854d0 /
8067  data wgk( 15) / 0.034979338028060024137499670731468d0 /
8068  data wgk( 16) / 0.036882364651821229223911065617136d0 /
8069  data wgk( 17) / 0.038678945624727592950348651532281d0 /
8070  data wgk( 18) / 0.040374538951535959111995279752468d0 /
8071  data wgk( 19) / 0.041969810215164246147147541285970d0 /
8072  data wgk( 20) / 0.043452539701356069316831728117073d0 /
8073  data wgk( 21) / 0.044814800133162663192355551616723d0 /
8074  data wgk( 22) / 0.046059238271006988116271735559374d0 /
8075  data wgk( 23) / 0.047185546569299153945261478181099d0 /
8076  data wgk( 24) / 0.048185861757087129140779492298305d0 /
8077  data wgk( 25) / 0.049055434555029778887528165367238d0 /
8078  data wgk( 26) / 0.049795683427074206357811569379942d0 /
8079  data wgk( 27) / 0.050405921402782346840893085653585d0 /
8080  data wgk( 28) / 0.050881795898749606492297473049805d0 /
8081  data wgk( 29) / 0.051221547849258772170656282604944d0 /
8082  data wgk( 30) / 0.051426128537459025933862879215781d0 /
8083  data wgk( 31) / 0.051494729429451567558340433647099d0 /
8084 
8085  epmach = epsilon( epmach )
8086  uflow = tiny( uflow )
8087  centr = 0.5d+00*(b+a)
8088  hlgth = 0.5d+00*(b-a)
8089  dhlgth = abs( hlgth)
8090  !
8091  ! compute the 61-point kronrod approximation to the
8092  ! integral, and estimate the absolute error.
8093  !
8094  resg = 0.0d+00
8095  fc = f(centr)
8096  resk = wgk(31)*fc
8097  resabs = abs( resk)
8098 
8099  do j=1,15
8100  jtw = j*2
8101  dabsc = hlgth*xgk(jtw)
8102  fval1 = f(centr-dabsc)
8103  fval2 = f(centr+dabsc)
8104  fv1(jtw) = fval1
8105  fv2(jtw) = fval2
8106  fsum = fval1+fval2
8107  resg = resg+wg(j)*fsum
8108  resk = resk+wgk(jtw)*fsum
8109  resabs = resabs+wgk(jtw)*( abs( fval1)+ abs( fval2))
8110  end do
8111 
8112  do j=1,15
8113  jtwm1 = j*2-1
8114  dabsc = hlgth*xgk(jtwm1)
8115  fval1 = f(centr-dabsc)
8116  fval2 = f(centr+dabsc)
8117  fv1(jtwm1) = fval1
8118  fv2(jtwm1) = fval2
8119  fsum = fval1+fval2
8120  resk = resk+wgk(jtwm1)*fsum
8121  resabs = resabs+wgk(jtwm1)*( abs( fval1)+ abs( fval2))
8122  end do
8123 
8124  reskh = resk*0.5d+00
8125  resasc = wgk(31)* abs( fc-reskh)
8126 
8127  do j=1,30
8128  resasc = resasc+wgk(j)*( abs( fv1(j)-reskh)+ abs( fv2(j)-reskh))
8129  end do
8130 
8131  result = resk*hlgth
8132  resabs = resabs*dhlgth
8133  resasc = resasc*dhlgth
8134  abserr = abs( (resk-resg)*hlgth)
8135  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) &
8136  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
8137  if(resabs.gt.uflow/(0.5d+02*epmach)) abserr = max &
8138  ((epmach*0.5d+02)*resabs,abserr)
8139 
8140  return
8141 end subroutine dqk61
8142 
8143  !----------------------------------------------------------------------------------------
8195 subroutine dqmomo(alfa,beta,ri,rj,rg,rh,integr)
8197  implicit none
8198 
8199  real ( kind = 8 ) alfa,alfp1,alfp2,an,anm1,beta,betp1,betp2,ralf, &
8200  rbet,rg,rh,ri,rj
8201  integer ( kind = 4 ) i,im1,integr
8202  dimension rg(25),rh(25),ri(25),rj(25)
8203 
8204  alfp1 = alfa+0.1d+01
8205  betp1 = beta+0.1d+01
8206  alfp2 = alfa+0.2d+01
8207  betp2 = beta+0.2d+01
8208  ralf = 0.2d+01**alfp1
8209  rbet = 0.2d+01**betp1
8210  !
8211  ! compute ri, rj using a forward recurrence relation.
8212  !
8213  ri(1) = ralf/alfp1
8214  rj(1) = rbet/betp1
8215  ri(2) = ri(1)*alfa/alfp2
8216  rj(2) = rj(1)*beta/betp2
8217  an = 0.2d+01
8218  anm1 = 0.1d+01
8219 
8220  do i=3,25
8221  ri(i) = -(ralf+an*(an-alfp2)*ri(i-1))/(anm1*(an+alfp1))
8222  rj(i) = -(rbet+an*(an-betp2)*rj(i-1))/(anm1*(an+betp1))
8223  anm1 = an
8224  an = an+0.1d+01
8225  end do
8226 
8227  if(integr.eq.1) go to 70
8228  if(integr.eq.3) go to 40
8229  !
8230  ! compute rg using a forward recurrence relation.
8231  !
8232  rg(1) = -ri(1)/alfp1
8233  rg(2) = -(ralf+ralf)/(alfp2*alfp2)-rg(1)
8234  an = 0.2d+01
8235  anm1 = 0.1d+01
8236  im1 = 2
8237 
8238  do i=3,25
8239  rg(i) = -(an*(an-alfp2)*rg(im1)-an*ri(im1)+anm1*ri(i))/ &
8240  (anm1*(an+alfp1))
8241  anm1 = an
8242  an = an+0.1d+01
8243  im1 = i
8244  end do
8245 
8246  if(integr.eq.2) go to 70
8247  !
8248  ! compute rh using a forward recurrence relation.
8249  !
8250 40 rh(1) = -rj(1)/betp1
8251  rh(2) = -(rbet+rbet)/(betp2*betp2)-rh(1)
8252  an = 0.2d+01
8253  anm1 = 0.1d+01
8254  im1 = 2
8255 
8256  do i=3,25
8257  rh(i) = -(an*(an-betp2)*rh(im1)-an*rj(im1)+ &
8258  anm1*rj(i))/(anm1*(an+betp1))
8259  anm1 = an
8260  an = an+0.1d+01
8261  im1 = i
8262  end do
8263 
8264  do i=2,25,2
8265  rh(i) = -rh(i)
8266  end do
8267 
8268 70 continue
8269 
8270  do i=2,25,2
8271  rj(i) = -rj(i)
8272  end do
8273 
8274 90 continue
8275 
8276  return
8277  end subroutine dqmomo
8278 
8279  !----------------------------------------------------------------------------------------
8393  subroutine dqng ( f, a, b, epsabs, epsrel, result, abserr, neval, ier )
8395  implicit none
8396 
8397  real ( kind = 8 ) a,absc,abserr,b,centr,dhlgth, &
8398  epmach,epsabs,epsrel,f,fcentr,fval,fval1,fval2,fv1,fv2, &
8399  fv3,fv4,hlgth,result,res10,res21,res43,res87,resabs,resasc, &
8400  reskh,savfun,uflow,w10,w21a,w21b,w43a,w43b,w87a,w87b,x1,x2,x3,x4
8401  integer ( kind = 4 ) ier,ipx,k,l,neval
8402  external f
8403  dimension fv1(5),fv2(5),fv3(5),fv4(5),x1(5),x2(5),x3(11),x4(22), &
8404  w10(5),w21a(5),w21b(6),w43a(10),w43b(12),w87a(21),w87b(23), &
8405  savfun(21)
8406 
8407  data x1( 1) / 0.973906528517171720077964012084452d0 /
8408  data x1( 2) / 0.865063366688984510732096688423493d0 /
8409  data x1( 3) / 0.679409568299024406234327365114874d0 /
8410  data x1( 4) / 0.433395394129247190799265943165784d0 /
8411  data x1( 5) / 0.148874338981631210884826001129720d0 /
8412  data w10( 1) / 0.066671344308688137593568809893332d0 /
8413  data w10( 2) / 0.149451349150580593145776339657697d0 /
8414  data w10( 3) / 0.219086362515982043995534934228163d0 /
8415  data w10( 4) / 0.269266719309996355091226921569469d0 /
8416  data w10( 5) / 0.295524224714752870173892994651338d0 /
8417 
8418  data x2( 1) / 0.995657163025808080735527280689003d0 /
8419  data x2( 2) / 0.930157491355708226001207180059508d0 /
8420  data x2( 3) / 0.780817726586416897063717578345042d0 /
8421  data x2( 4) / 0.562757134668604683339000099272694d0 /
8422  data x2( 5) / 0.294392862701460198131126603103866d0 /
8423  data w21a( 1) / 0.032558162307964727478818972459390d0 /
8424  data w21a( 2) / 0.075039674810919952767043140916190d0 /
8425  data w21a( 3) / 0.109387158802297641899210590325805d0 /
8426  data w21a( 4) / 0.134709217311473325928054001771707d0 /
8427  data w21a( 5) / 0.147739104901338491374841515972068d0 /
8428  data w21b( 1) / 0.011694638867371874278064396062192d0 /
8429  data w21b( 2) / 0.054755896574351996031381300244580d0 /
8430  data w21b( 3) / 0.093125454583697605535065465083366d0 /
8431  data w21b( 4) / 0.123491976262065851077958109831074d0 /
8432  data w21b( 5) / 0.142775938577060080797094273138717d0 /
8433  data w21b( 6) / 0.149445554002916905664936468389821d0 /
8434  !
8435  data x3( 1) / 0.999333360901932081394099323919911d0 /
8436  data x3( 2) / 0.987433402908088869795961478381209d0 /
8437  data x3( 3) / 0.954807934814266299257919200290473d0 /
8438  data x3( 4) / 0.900148695748328293625099494069092d0 /
8439  data x3( 5) / 0.825198314983114150847066732588520d0 /
8440  data x3( 6) / 0.732148388989304982612354848755461d0 /
8441  data x3( 7) / 0.622847970537725238641159120344323d0 /
8442  data x3( 8) / 0.499479574071056499952214885499755d0 /
8443  data x3( 9) / 0.364901661346580768043989548502644d0 /
8444  data x3( 10) / 0.222254919776601296498260928066212d0 /
8445  data x3( 11) / 0.074650617461383322043914435796506d0 /
8446  data w43a( 1) / 0.016296734289666564924281974617663d0 /
8447  data w43a( 2) / 0.037522876120869501461613795898115d0 /
8448  data w43a( 3) / 0.054694902058255442147212685465005d0 /
8449  data w43a( 4) / 0.067355414609478086075553166302174d0 /
8450  data w43a( 5) / 0.073870199632393953432140695251367d0 /
8451  data w43a( 6) / 0.005768556059769796184184327908655d0 /
8452  data w43a( 7) / 0.027371890593248842081276069289151d0 /
8453  data w43a( 8) / 0.046560826910428830743339154433824d0 /
8454  data w43a( 9) / 0.061744995201442564496240336030883d0 /
8455  data w43a( 10) / 0.071387267268693397768559114425516d0 /
8456  data w43b( 1) / 0.001844477640212414100389106552965d0 /
8457  data w43b( 2) / 0.010798689585891651740465406741293d0 /
8458  data w43b( 3) / 0.021895363867795428102523123075149d0 /
8459  data w43b( 4) / 0.032597463975345689443882222526137d0 /
8460  data w43b( 5) / 0.042163137935191811847627924327955d0 /
8461  data w43b( 6) / 0.050741939600184577780189020092084d0 /
8462  data w43b( 7) / 0.058379395542619248375475369330206d0 /
8463  data w43b( 8) / 0.064746404951445885544689259517511d0 /
8464  data w43b( 9) / 0.069566197912356484528633315038405d0 /
8465  data w43b( 10) / 0.072824441471833208150939535192842d0 /
8466  data w43b( 11) / 0.074507751014175118273571813842889d0 /
8467  data w43b( 12) / 0.074722147517403005594425168280423d0 /
8468 
8469  data x4( 1) / 0.999902977262729234490529830591582d0 /
8470  data x4( 2) / 0.997989895986678745427496322365960d0 /
8471  data x4( 3) / 0.992175497860687222808523352251425d0 /
8472  data x4( 4) / 0.981358163572712773571916941623894d0 /
8473  data x4( 5) / 0.965057623858384619128284110607926d0 /
8474  data x4( 6) / 0.943167613133670596816416634507426d0 /
8475  data x4( 7) / 0.915806414685507209591826430720050d0 /
8476  data x4( 8) / 0.883221657771316501372117548744163d0 /
8477  data x4( 9) / 0.845710748462415666605902011504855d0 /
8478  data x4( 10) / 0.803557658035230982788739474980964d0 /
8479  data x4( 11) / 0.757005730685495558328942793432020d0 /
8480  data x4( 12) / 0.706273209787321819824094274740840d0 /
8481  data x4( 13) / 0.651589466501177922534422205016736d0 /
8482  data x4( 14) / 0.593223374057961088875273770349144d0 /
8483  data x4( 15) / 0.531493605970831932285268948562671d0 /
8484  data x4( 16) / 0.466763623042022844871966781659270d0 /
8485  data x4( 17) / 0.399424847859218804732101665817923d0 /
8486  data x4( 18) / 0.329874877106188288265053371824597d0 /
8487  data x4( 19) / 0.258503559202161551802280975429025d0 /
8488  data x4( 20) / 0.185695396568346652015917141167606d0 /
8489  data x4( 21) / 0.111842213179907468172398359241362d0 /
8490  data x4( 22) / 0.037352123394619870814998165437704d0 /
8491  data w87a( 1) / 0.008148377384149172900002878448190d0 /
8492  data w87a( 2) / 0.018761438201562822243935059003794d0 /
8493  data w87a( 3) / 0.027347451050052286161582829741283d0 /
8494  data w87a( 4) / 0.033677707311637930046581056957588d0 /
8495  data w87a( 5) / 0.036935099820427907614589586742499d0 /
8496  data w87a( 6) / 0.002884872430211530501334156248695d0 /
8497  data w87a( 7) / 0.013685946022712701888950035273128d0 /
8498  data w87a( 8) / 0.023280413502888311123409291030404d0 /
8499  data w87a( 9) / 0.030872497611713358675466394126442d0 /
8500  data w87a( 10) / 0.035693633639418770719351355457044d0 /
8501  data w87a( 11) / 0.000915283345202241360843392549948d0 /
8502  data w87a( 12) / 0.005399280219300471367738743391053d0 /
8503  data w87a( 13) / 0.010947679601118931134327826856808d0 /
8504  data w87a( 14) / 0.016298731696787335262665703223280d0 /
8505  data w87a( 15) / 0.021081568889203835112433060188190d0 /
8506  data w87a( 16) / 0.025370969769253827243467999831710d0 /
8507  data w87a( 17) / 0.029189697756475752501446154084920d0 /
8508  data w87a( 18) / 0.032373202467202789685788194889595d0 /
8509  data w87a( 19) / 0.034783098950365142750781997949596d0 /
8510  data w87a( 20) / 0.036412220731351787562801163687577d0 /
8511  data w87a( 21) / 0.037253875503047708539592001191226d0 /
8512  data w87b( 1) / 0.000274145563762072350016527092881d0 /
8513  data w87b( 2) / 0.001807124155057942948341311753254d0 /
8514  data w87b( 3) / 0.004096869282759164864458070683480d0 /
8515  data w87b( 4) / 0.006758290051847378699816577897424d0 /
8516  data w87b( 5) / 0.009549957672201646536053581325377d0 /
8517  data w87b( 6) / 0.012329447652244853694626639963780d0 /
8518  data w87b( 7) / 0.015010447346388952376697286041943d0 /
8519  data w87b( 8) / 0.017548967986243191099665352925900d0 /
8520  data w87b( 9) / 0.019938037786440888202278192730714d0 /
8521  data w87b( 10) / 0.022194935961012286796332102959499d0 /
8522  data w87b( 11) / 0.024339147126000805470360647041454d0 /
8523  data w87b( 12) / 0.026374505414839207241503786552615d0 /
8524  data w87b( 13) / 0.028286910788771200659968002987960d0 /
8525  data w87b( 14) / 0.030052581128092695322521110347341d0 /
8526  data w87b( 15) / 0.031646751371439929404586051078883d0 /
8527  data w87b( 16) / 0.033050413419978503290785944862689d0 /
8528  data w87b( 17) / 0.034255099704226061787082821046821d0 /
8529  data w87b( 18) / 0.035262412660156681033782717998428d0 /
8530  data w87b( 19) / 0.036076989622888701185500318003895d0 /
8531  data w87b( 20) / 0.036698604498456094498018047441094d0 /
8532  data w87b( 21) / 0.037120549269832576114119958413599d0 /
8533  data w87b( 22) / 0.037334228751935040321235449094698d0 /
8534  data w87b( 23) / 0.037361073762679023410321241766599d0 /
8535 
8536  epmach = epsilon( epmach )
8537  uflow = tiny( uflow )
8538  !
8539  ! test on validity of parameters
8540  !
8541  result = 0.0d+00
8542  abserr = 0.0d+00
8543  neval = 0
8544  ier = 6
8545  if(epsabs.le.0.0d+00.and.epsrel.lt. max( 0.5d+02*epmach,0.5d-28)) &
8546  go to 80
8547  hlgth = 0.5d+00*(b-a)
8548  dhlgth = abs( hlgth)
8549  centr = 0.5d+00*(b+a)
8550  fcentr = f(centr)
8551  neval = 21
8552  ier = 1
8553  !
8554  ! compute the integral using the 10- and 21-point formula.
8555  !
8556  do 70 l = 1,3
8557 
8558  go to (5,25,45),l
8559 
8560 5 res10 = 0.0d+00
8561  res21 = w21b(6)*fcentr
8562  resabs = w21b(6)* abs( fcentr)
8563 
8564  do k=1,5
8565  absc = hlgth*x1(k)
8566  fval1 = f(centr+absc)
8567  fval2 = f(centr-absc)
8568  fval = fval1+fval2
8569  res10 = res10+w10(k)*fval
8570  res21 = res21+w21a(k)*fval
8571  resabs = resabs+w21a(k)*( abs( fval1)+ abs( fval2))
8572  savfun(k) = fval
8573  fv1(k) = fval1
8574  fv2(k) = fval2
8575  end do
8576 
8577  ipx = 5
8578 
8579  do k=1,5
8580  ipx = ipx+1
8581  absc = hlgth*x2(k)
8582  fval1 = f(centr+absc)
8583  fval2 = f(centr-absc)
8584  fval = fval1+fval2
8585  res21 = res21+w21b(k)*fval
8586  resabs = resabs+w21b(k)*( abs( fval1)+ abs( fval2))
8587  savfun(ipx) = fval
8588  fv3(k) = fval1
8589  fv4(k) = fval2
8590  end do
8591  !
8592  ! test for convergence.
8593  !
8594  result = res21*hlgth
8595  resabs = resabs*dhlgth
8596  reskh = 0.5d+00*res21
8597  resasc = w21b(6)* abs( fcentr-reskh)
8598 
8599  do k = 1,5
8600  resasc = resasc+w21a(k)*( abs( fv1(k)-reskh)+ abs( fv2(k)-reskh)) &
8601  +w21b(k)*( abs( fv3(k)-reskh)+ abs( fv4(k)-reskh))
8602  end do
8603 
8604  abserr = abs( (res21-res10)*hlgth)
8605  resasc = resasc*dhlgth
8606  go to 65
8607  !
8608  ! compute the integral using the 43-point formula.
8609  !
8610 25 res43 = w43b(12)*fcentr
8611  neval = 43
8612 
8613  do k=1,10
8614  res43 = res43+savfun(k)*w43a(k)
8615  end do
8616 
8617  do k=1,11
8618  ipx = ipx+1
8619  absc = hlgth*x3(k)
8620  fval = f(absc+centr)+f(centr-absc)
8621  res43 = res43+fval*w43b(k)
8622  savfun(ipx) = fval
8623  end do
8624  !
8625  ! test for convergence.
8626  !
8627  result = res43*hlgth
8628  abserr = abs( (res43-res21)*hlgth)
8629  go to 65
8630  !
8631  ! compute the integral using the 87-point formula.
8632  !
8633 45 res87 = w87b(23)*fcentr
8634  neval = 87
8635 
8636  do k=1,21
8637  res87 = res87+savfun(k)*w87a(k)
8638  end do
8639 
8640  do k=1,22
8641  absc = hlgth*x4(k)
8642  res87 = res87+w87b(k)*(f(absc+centr)+f(centr-absc))
8643  end do
8644 
8645  result = res87*hlgth
8646  abserr = abs( (res87-res43)*hlgth)
8647 
8648 65 continue
8649 
8650  if(resasc.ne.0.0d+00.and.abserr.ne.0.0d+00) then
8651  abserr = resasc* min(0.1d+01,(0.2d+03*abserr/resasc)**1.5d+00)
8652  end if
8653 
8654  if (resabs.gt.uflow/(0.5d+02*epmach)) then
8655  abserr = max((epmach*0.5d+02)*resabs,abserr)
8656  end if
8657 
8658  if (abserr.le. max( epsabs,epsrel* abs( result))) then
8659  ier = 0
8660  return
8661  end if
8662 
8663 70 continue
8664 
8665 80 call xerror('abnormal return from dqng ',26,ier,0)
8666 999 continue
8667 
8668  return
8669 end subroutine dqng
8670 
8671  !----------------------------------------------------------------------------------------
8722 subroutine dqpsrt ( limit, last, maxerr, ermax, elist, iord, nrmax )
8724  implicit none
8725 
8726  real ( kind = 8 ) elist,ermax,errmax,errmin
8727  integer ( kind = 4 ) i,ibeg,ido,iord,isucc,j,jbnd,jupbn,k,last, &
8728  lim
8729  integer ( kind = 4 ) limit
8730  integer ( kind = 4 ) maxerr
8731  integer ( kind = 4 ) nrmax
8732  dimension elist(last),iord(last)
8733  !
8734  ! check whether the list contains more than
8735  ! two error estimates.
8736  !
8737  if(last.gt.2) go to 10
8738  iord(1) = 1
8739  iord(2) = 2
8740  go to 90
8741  !
8742  ! this part of the routine is only executed if, due to a
8743  ! difficult integrand, subdivision increased the error
8744  ! estimate. in the normal case the insert procedure should
8745  ! start after the nrmax-th largest error estimate.
8746  !
8747 10 errmax = elist(maxerr)
8748 
8749  ido = nrmax-1
8750  do i = 1,ido
8751  isucc = iord(nrmax-1)
8752  if(errmax.le.elist(isucc)) go to 30
8753  iord(nrmax) = isucc
8754  nrmax = nrmax-1
8755  end do
8756  !
8757  ! compute the number of elements in the list to be maintained
8758  ! in descending order. this number depends on the number of
8759  ! subdivisions still allowed.
8760  !
8761 30 jupbn = last
8762  if(last.gt.(limit/2+2)) jupbn = limit+3-last
8763  errmin = elist(last)
8764  !
8765  ! insert errmax by traversing the list top-down,
8766  ! starting comparison from the element elist(iord(nrmax+1)).
8767  !
8768  jbnd = jupbn-1
8769  ibeg = nrmax+1
8770 
8771  do i=ibeg,jbnd
8772  isucc = iord(i)
8773  if(errmax.ge.elist(isucc)) go to 60
8774  iord(i-1) = isucc
8775  end do
8776 
8777  iord(jbnd) = maxerr
8778  iord(jupbn) = last
8779  go to 90
8780  !
8781  ! insert errmin by traversing the list bottom-up.
8782  !
8783 60 iord(i-1) = maxerr
8784  k = jbnd
8785 
8786  do j=i,jbnd
8787  isucc = iord(k)
8788  if(errmin.lt.elist(isucc)) go to 80
8789  iord(k+1) = isucc
8790  k = k-1
8791  end do
8792 
8793  iord(i) = last
8794  go to 90
8795 80 iord(k+1) = last
8796  !
8797  ! set maxerr and ermax.
8798  !
8799 90 maxerr = iord(nrmax)
8800  ermax = elist(maxerr)
8801 
8802  return
8803 end subroutine dqpsrt
8804 
8805 end module eftcamb_quadpack
This module contains the relevant code for the double precision QUADPACK integration library...
subroutine dgtsl(n, c, d, e, b, info)
DGTSL solves a general tridiagonal linear system.
subroutine dqpsrt(limit, last, maxerr, ermax, elist, iord, nrmax)
DQPSRT maintains the order of a list of local error estimates.
subroutine dqagie(f, bound, inf, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
DQAGIE estimates an integral over a semi-infinite or infinite interval.
subroutine dqagpe(f, a, b, npts2, points, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, pts, iord, level, ndin, last)
DQAGPE computes a definite integral.
subroutine dqk15i(f, boun, inf, a, b, result, abserr, resabs, resasc)
DQK15I applies a 15 point Gauss-Kronrod quadrature on an infinite interval.
subroutine dqawc(f, a, b, c, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work)
DQAWC computes a Cauchy principal value.
subroutine dqelg(n, epstab, result, abserr, res3la, nres)
DQELG carries out the Epsilon extrapolation algorithm.
subroutine dqk15w(f, w, p1, p2, p3, p4, kp, a, b, result, abserr, resabs, resasc)
DQK15W applies a 15 point Gauss-Kronrod rule for a weighted integrand.
subroutine dqagp(f, a, b, npts2, points, epsabs, epsrel, result, abserr, neval, ier, leniw, lenw, last, iwork, work)
DQAGP computes a definite integral.
subroutine dqk41(f, a, b, result, abserr, resabs, resasc)
DQK41 carries out a 41 point Gauss-Kronrod quadrature rule.
real(kind=8) function dqwgtf(x, omega, p2, p3, p4, integr)
DQWGTF defines the weight functions used by DQC25F.
subroutine dqk15(f, a, b, result, abserr, resabs, resasc)
DQK15 carries out a 15 point Gauss-Kronrod quadrature rule.
subroutine dqawce(f, a, b, c, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
DQAWCE computes a Cauchy principal value.
subroutine dqawfe(f, a, omega, integr, epsabs, limlst, limit, maxp1, result, abserr, neval, ier, rslst, erlst, ierlst, lst, alist, blist, rlist, elist, iord, nnlog, chebmo)
DQAWFE computes Fourier integrals.
subroutine dqagse(f, a, b, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
DQAGSE estimates the integral of a function.
subroutine dqc25f(f, a, b, omega, integr, nrmom, maxp1, ksave, result, abserr, neval, resabs, resasc, momcom, chebmo)
DQC25F returns integration rules for functions with a COS or SIN factor.
subroutine dqagi(f, bound, inf, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work)
DQAGI estimates an integral over a semi-infinite or infinite interval.
real(kind=8) function dqwgtc(x, c, p2, p3, p4, kp)
DQWGTC defines the weight function used by DQC25C.
subroutine xerror(xmess, nmess, nerr, level)
XERROR replaces the SLATEC XERROR routine.
subroutine dqawo(f, a, b, omega, integr, epsabs, epsrel, result, abserr, neval, ier, leniw, maxp1, lenw, last, iwork, work)
DQAWO computes the integrals of oscillatory integrands.
subroutine dqc25c(f, a, b, c, result, abserr, krul, neval)
DQC25C returns integration rules for Cauchy Principal Value integrals.
subroutine dqage(f, a, b, epsabs, epsrel, key, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
DQAGE estimates a definite integral.
subroutine dqawf(f, a, omega, integr, epsabs, result, abserr, neval, ier, limlst, lst, leniw, maxp1, lenw, iwork, work)
DQAWF computes Fourier integrals over the interval [ A, +Infinity ).
subroutine dqawse(f, a, b, alfa, beta, integr, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
DQAWSE estimates integrals with algebraico-logarithmic end singularities.
subroutine dqk51(f, a, b, result, abserr, resabs, resasc)
DQK51 carries out a 51 point Gauss-Kronrod quadrature rule.
subroutine dqk61(f, a, b, result, abserr, resabs, resasc)
DQK61 carries out a 61 point Gauss-Kronrod quadrature rule.
subroutine dqk31(f, a, b, result, abserr, resabs, resasc)
DQK31 carries out a 31 point Gauss-Kronrod quadrature rule.
subroutine dqaws(f, a, b, alfa, beta, integr, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work)
DQAWS estimates integrals with algebraico-logarithmic endpoint singularities.
subroutine dqcheb(x, fval, cheb12, cheb24)
DQCHEB computes the Chebyshev series expansion.
real(kind=8) function dqwgts(x, a, b, alfa, beta, integr)
DQWGTS defines the weight functions used by DQC25S.
subroutine dqng(f, a, b, epsabs, epsrel, result, abserr, neval, ier)
DQNG estimates an integral, using non-adaptive integration.
subroutine dqag(f, a, b, epsabs, epsrel, key, result, abserr, neval, ier, limit, lenw, last, iwork, work)
DQAG approximates an integral over a finite interval.
subroutine dqawoe(f, a, b, omega, integr, epsabs, epsrel, limit, icall, maxp1, result, abserr, neval, ier, last, alist, blist, rlist, elist, iord, nnlog, momcom, chebmo)
DQAWOE computes the integrals of oscillatory integrands.
subroutine dqc25s(f, a, b, bl, br, alfa, beta, ri, rj, rg, rh, result, abserr, resasc, integr, nev)
DQC25S returns rules for algebraico-logarithmic end point singularities.
subroutine dqags(f, a, b, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work)
DQAGS estimates the integral of a function.
subroutine dqk21(f, a, b, result, abserr, resabs, resasc)
DQK21 carries out a 21 point Gauss-Kronrod quadrature rule.
subroutine dqmomo(alfa, beta, ri, rj, rg, rh, integr)
DQMOMO computes modified Chebyshev moments.