8 SUBROUTINE gadap(A0,B0,F,EPS,SUM)
27 common/gadap1/
num,ifu
32 REAL aa,bb,f1f,f2f,f3f
33 REAL a0,b0,f,
eps,sum,a,b,f1,
f2,f3,
s
34 REAL dsum,
c,red,w1,u2,ss,sold
36 dimension a(300),b(300),f1(300),
f2(300),f3(300),
s(300),
n(300)
37 1
FORMAT(16h
gadap:i too big)
38 dsum(f1f,f2f,f3f,aa,bb)=5./18.*(bb-aa)*(f1f+1.6*f2f+f3f)
39 IF(
eps.LT.1.0e-8)
eps=1.0e-8
47 f1(1)=f(0.5*(1+
c)*a0+0.5*(1-
c)*b0)
49 f3(1)=f(0.5*(1-
c)*a0+0.5*(1+
c)*b0)
51 s(1)= dsum(f1(1),
f2(1),f3(1),a0,b0)
56 a(i+1)=a(i)+
c*(b(i)-a(i))
58 a(i+2)=a(i)+b(i)-a(i+1)
62 w1=a(i)+(b(i)-a(i))/5.
63 u2=2.*w1-(a(i)+a(i+2))/2.
64 f1(i+1)=f(a(i)+b(i)-w1)
66 f3(i+1)=f(b(i)-a(i+2)+w1)
69 f3(i+2)=f(b(i+2)+a(i+2)-u2)
70 f1(i+3)=f(a(i)+a(i+2)-w1)
74 IF(ifu.GT.5000) goto 130
75 s(i+1)= dsum(f1(i+1),
f2(i+1),f3(i+1),a(i+1),b(i+1))
76 s(i+2)= dsum(f1(i+2),
f2(i+2),f3(i+2),a(i+2),b(i+2))
77 s(i+3)= dsum(f1(i+3),
f2(i+3),f3(i+3),a(i+3),b(i+3))
78 ss=
s(i+1)+
s(i+2)+
s(i+3)
82 IF(abs(sold-ss).GT.
eps*(1.+abs(ss))/2.) goto 100
91 IF(
n(l).NE.0) goto 100