how can I speed up bromberg?



On Nov. 21, 2012, I wrote:
-------------------------------
>However in reference to your last remarks, I would like to emphasize
> that the famous tanh-sinh quadrature method has been
>available to Maxima users for a "long time".
>
> I posted the Ch.9, Maxima by Example, mbe9bfloat.pdf (see pp. 21-26),
>in April, 2009, (with a long message to the mailing list) which is
> titled: "Bigfloats and Arbitrary Precision Quadrature", and section 9.3.3
> has a detailed discussion of the ideas behind the tanh-sinh method,
> and the Mmaxima implementation, with the Ch.9 file quad_ts.mac
> allowing Maxima users to try out this method with their integrals.
>
>When posting recently the latest version of Ch. 8 and its new software
> files (as used below), I should have mentioned that the arbitrary 
> precision
> functions apnint and apquad make use of the tanh-sinh method for
>a finite domain, and the double exponential method (also available in
> Ch. 9 since 2009) for a non-finite domain.
>
>Both of these methods (the tanh-sinh method seems more powerful and faster
>than the Gauss-Legendre bigfloat method also available and discussed
>in ch. 9) make use of your excellent bigfloat package.
>

I should have mentioned that once the user has asked for an integral
with a given working precision (such as fpprec = 30), any later integrals
done (in the same session, with the same working precision) will take
a much smaller time than the first, since the array of transformation
coefficients computed with that value of fpprec only has to be
computed once. Here is an example; the first two integrals
have the same integrand, the third and fourth integrands are
different:
----------------------------------

(%i1) (load(nint),load(apnint));
   _kmax% =  8   _epsfac% =  2
(%o1) "c:/work2/apnint.mac"

(%i2) method:true$

(%i3) tval : bfloat(2 - log(4)),fpprec:50;
(%o3) 6.1370563888010938116553575708364686384899973127949b-1

(%i4) apval : apnint(1/(1+sqrt(x)),x,0,1,20,30);
 construct _yw%[kk,fpprec] array for kk =
  8  and fpprec =  30   ...working...
tsquad
(%o4) 6.13705638880109381165535757084b-1

(%i5) time(%);
(%o5) [3.07]

(%i6) abs(apval - tval),fpprec:50;
(%o6) 3.8940901847614999031707591170620170928280850060151b-31

(%i7) apnint(1/(1+sqrt(x)),x,0,1,20,30);
tsquad
(%o7) 6.13705638880109381165535757084b-1

(%i8) time(%);
(%o8) [0.3]

(%i9) apnint(sin(sin(x)),x,0,1,20,30);
tsquad
(%o9) 4.30606103120690604912377355249b-1

(%i10) time(%);
(%o10) [1.5]

(%i13) apquad(sin(x),x,0,1,20,30);
tsquad
(%o13) 4.59697694131860282599063392557b-1

(%i14) time(%);
(%o14) [0.24]

-------------------------
Only for the first integral do you see the progress
message:

 construct _yw%[kk,fpprec] array for kk =
  8  and fpprec =  30   ...working...



By the way, the "true value" of
integrate (1/(1+sqrt(x)),x,0,1), used for %i3,
was from the symbolic result produced by wolfram
alpha; Maxima's integrate can't cope.

For the simple integral of sin(x), which integrate
can do!, we forced the use of the tanh-sinh numerical
method by using apquad. (apnint would get a
good answer from integrate and return that with
the requested precision.)


Ted

http://www.csulb.edu/~woollett/