On Fri, 29 Jun 2001, Richard B. Kreckel wrote:
Suppose I use symbolic manipulations to arrive at a formula like
ex f = sin(x) + tgamma(1+x) + pow(x,5) + more complicated stuff
and I would like to do a Monte Carlo integration
int( f , x=0..1)
and I would like to get an accuracy of 2 or 3 digits in a reasonable amount of time.
I tried something similar in Maple about 3 years ago (for insiders: Dirk's integral representation for 2loop 2point functions), a 2fold Monte Carlo integration on a not-too-complex function (logs of rational arguments times a rational function). I rewrote Vegas in Maple and used its evalhf() function which evaluates expressions with the floating point hardware in double precision (because - again for insiders - xloops automatically emitted the function as a C program, compiled it, linked it with Vegas, spawned an external process and read the results from a file). I thought it would be faster to stay inside Maple, at least for some "preview mode". However Maple turned out to be unusably slow, IIRC a factor 500. I expect similar results for a GiNaC in double-precision mode.
Alternatively emit the file, automatically add the necessary boilerplate, compile it and link it back in using dlopen(3). On systems that support dlopen, such as Linux, with a little effort the whole procedure can be entirely autmated, as far as I can see.
I think it is worth writing a prototype for this and include it in the distribution (or at least documentation) if it is generic enough. cint can use a similar trick (#pragma compile). Alex -- Alexander Frink E-Mail: Alexander.Frink@Uni-Mainz.DE Institut fuer Physik Phone: +49-6131-3923391 Johannes-Gutenberg-Universitaet D-55099 Mainz, Germany