On Nov. 24, 2012, I wrote
>Setting global fpprec higher does the job; I had been assuming
>that the new bromberg did that job locally based on the
>requested precision.
The function qromberg, shown below, allows local setting of
fpprec, brombergit, brombergtol, brombergabs,
with the requested number of digits (requested precision)
being rp, and the requested working precision (fpprec)
being wp, with a syntax similar to apnint and apquad.
syntax: qbromberg (expr, x, x1, x2, rp, wp)
------------------------------------------------
/* qbromberg.mac Nov, 24, 2012 */
load("c:/work2/bromberg.lisp")$
qbromberg (bf,bx,bx1,bx2,brp,bwp) :=
block([fpprec:bwp,brombergit:20,brombergtol:0,brombergabs:10^(-brp)],
local(bff),
define(bff(bx),bf),
bromberg(bff,bx1,bx2))$
---------------------------------------------
(%i1) load(qbromberg);
(%o1) "c:/work2/qbromberg.mac"
(%i2) tval : bfloat(2 - sqrt(2) - 2*log(4) + 2*log(2 + sqrt(2))),fpprec:50;
(%o2) 2.6909206998615507341183356137535683526014837806556b-1
(%i3) bval : qbromberg(1/(1+sqrt(x)),x,1/2,1,20,30);
(%o3) 2.69092069986155073411833610938b-1
(%i4) time(%);
(%o4) [0.09]
(%i5) abs(bval - tval),fpprec:30;
(%o5) 4.95626515608388823368837587657b-26
(%i6) fpprec;
(%o6) 16
----------------------------------------------
Timing and accuracy trials will be done for arbitrary precision
quadrature over a finite domain, comparing
1.) apquad (using the tanh-sinh method of Ch. 8 and Ch.9),
2.) quad_gs of Ch. 9 which is a bigfloat Gauss-Legendre
method, and
3.) qbromberg as shown here.
Ted Woollett