how can I speed up bromberg?



>>>>> "Edwin" == Edwin Woollett <woollett at charter.net> writes:

    Edwin> On Nov. 20, Ramond Toy wrote:
    Edwin> ---------------------------------
    >> Oops. I've uploaded a new version that fixes this.
    >> 
    >> Unfortunately, it still takes a very long time.  My original test used
    >> the default parameters and it converged very quickly.  With your new
    >> parameters, I gave up after a minute or so.
    >> 
    >> But I think the problem is with the integrand, 1/(1+sqrt(x)).  I'm
    >> guessing the infinite slope at 0 is going to give lots of trouble.
    >> bromberg(g, 1/2, 1) returns instantly. bromberg(g,1/100,1) takes a
    >> little bit longer.
    Edwin> ----------------------------------------

    Edwin> The new version of bromberg.lisp,
    Edwin> http://common-lisp.net/~rtoy/maxima/bromberg.lisp
    Edwin> no longer gives a lisp error (gcl), but is extremely
    Edwin> slow (I stopped the calculation after 13 min)
    Edwin> if I ask for 20 digit precision for the same
    Edwin> integrand over (1/2, 1) interval.
    Edwin> ----------------------------------------

[snip]

    Edwin> (%i9) brombergabs:1.0b-20;
    Edwin> (%o9) 1.0b-20

    Edwin> (%i10) bval : bromberg(g,1/2,1);
    Edwin> Maxima encountered a Lisp error:

    Edwin> Console interrupt.
    Edwin> -------------------------------------------

    Edwin> I stopped the calculation after 13 min.

Interesting.  Here is what I get using cmucl on a 3GHz mac:

(%i21) brombergabs:1b-20;
Evaluation took 0.0000 seconds (0.0000 elapsed) using 16 bytes.
(%o21)                              1.0b-20
(%i22) bromberg(1/(1+sqrt(x)),1/2,1);
Evaluation took 0.0300 seconds (0.0300 elapsed) using 3.304 MB.
(%o22)                2.69092069986155073411833610938b-1
(%i23) fpprec:50;
Evaluation took 0.0000 seconds (0.0100 elapsed) using 304 bytes.
(%o23)                                50
(%i24) bromberg(1/(1+sqrt(x)),1/2,1);
Evaluation took 0.0300 seconds (0.0300 elapsed) using 4.150 MB.
(%o24)      2.6909206998615507341183361093738044447610421970518b-1
(%i25) intanalysis:false;
Evaluation took 0.0000 seconds (0.0000 elapsed) using 32 bytes.
(%o25)                               false
(%i26) integrate(1/(1+sqrt(x)),x,1/2,1);
Evaluation took 0.0200 seconds (0.0200 elapsed) using 1.488 MB.
                        sqrt(2) + 2
(%o26)            2 log(-----------) - 2 log(2) - sqrt(2) + 2
                             2
(%i27) bfloat(%);
Evaluation took 0.0100 seconds (0.0000 elapsed) using 205.758 KB.
(%o27)      2.6909206998615507341183356137535683526014837806556b-1
(%i28) abs(%o27-%o24);
Evaluation took 0.0000 seconds (0.0000 elapsed) using 1.945 KB.
(%o28)      4.9562023609215955841639624413515919194794533741279b-26

There must be something weird about how gcl handles the code.  Or
maybe how it handles the numeric bigfloat routines.

Ray