read EKHAD: print(``): print(`Version of March 17, 1997`): print(`This Maple program accompanies the paper`): print(`"Hypergeometric Series acceleration via the WZ Method"`): print(`by Tewodros Amdeberhan and Doron Zeilberger.`): print(`For a WZ-pair (F,G), the package "accel" gives`): print(`the corresponding accelerated computation.`): print(``): print(`To use it: type`): print(`accel(F,s,t,b,c), where`): print(`F=F(n,k), s=dilation in n, t=dilation in k,`): print(`b=# of terms and c=# of digits.`): accel:=proc(F,s,t,b,c) local X,Y,t1,t2,t3,t4,P,Q,gu,gu1,R,R0,hyp,tt,tt1,j,i,tm1 ,m,N,G: tm1:=time(): gu:=zeil(F,k,n,N): G:=1/coeff(gu[1],N,1)*gu[2]*F: Q:=coeff(gu[1],N,1): P:=gu[2]/Q: X:=simplify(F/subs(n=n+1,F)): Y:=simplify(F/subs(k=k+1,F)): t1:=1: t2:=0: t3:=1: t4:=1: if t>1 then for i from 2 to t do t3:=subs(k=k-i,Y)*t3: t4:=simplify(t3+t4): od: t4:=simplify(subs(n=s*n+s,k=t*n+t,t4)): t3:=subs(n=s*n+s,k=t*n+t,t3): fi: for j from 1 to s do t1:=subs(n=n-j,X)*t1: t2:=simplify(subs(n=n-j,P)*t1 + t2): od: tt:=simplify(subs(n=s*n+s,k=t*n,t2)*t3): tt1:=factor(simplify(tt+t4)): hyp:=subs(n=s*n+s,k=t*n+t-1,F): tt:=tt1*hyp: print(``): print(`The series of terms:`): print(simplify(subs(k=0,G))): print(`is accelerated by computing the series of terms:`): print(tt): gu1:=simplify(subs(n=0,tt)):R:=simplify(hyp/subs(n=n-1,hyp)): R0:=subs(n=0,hyp): for m from 1 to b do R0:=subs(n=m,R)*R0: gu1:=R0*subs(n=m,tt1)+gu1: od: gu1:=evalf(gu1,c): print(`and the value to`):print(c):print(`digits is:`): print(gu1): print(`This took`): print(time()-tm1): print(`seconds of CPU time`): end: