how can I speed up bromberg?



On 2012-11-23, Edwin Woollett <woollett at charter.net> wrote:

> (%i1) display2d:false$
> (%i2) load("c:/work2/bromberg.lisp");
> (%o2) "c:/work2/bromberg.lisp"
> (%i3) [brombergtol,brombergabs,brombergit,brombergmin];
> (%o3) [1.0E-4,0.0,11,0]
> (%i4) (brombergtol:0.0b0,brombergit:100)$
> (%i5) brombergabs:1.0b-10;
> (%o5) 1.0b-10
> (%i6) g(x):= 1/(1+sqrt(x))$
> (%i7) bromberg(g,1/2,1);
> (%o7) 2.6909206998617b-1
> (%i8) time(%);
> (%o8) [0.1]
> (%i9) brombergabs:1.0b-20;
> (%o9) 1.0b-20
> (%i10) bval : bromberg(g,1/2,1);
> Maxima encountered a Lisp error:
>
>  Console interrupt.
> (stopped after 8 min)

This doesn't seem to be GCL-specific; I get the same behavior with CMUCL.

I think the problem in this example (dunno if this is the same as other
examples considered in this thread, I haven't been paying attention) is
that you have assigned brombergabs which is smaller than the current
value of 10^(- fpprec) (namely 10^-16). So bromberg can never satisfy
brombergabs, so it keeps going up to brombergit. The number of function
evaluations before giving up is 2^brombergit + 1 = 2^100 + 1. It will
take a long time to evaluate the integrand that many times.

What happens if you increase the value of fpprec, to, say, 50?

Incidentally I find that bromberg complains about g unless I call
compile(g) before calling bromberg.

best,

Robert Dodier