Wishlist

Stefan Weinzierl stefanw at fis.unipr.it
Fri Jun 29 11:38:49 CEST 2001


Gentlemen,

this mail is a little bit related to the mail from Richy last Friday
(class function revisited ...).

If you are planning to revise this issue, I have some suggestions what
could be useful in the future.

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.

The fastest way would certainly be to print f as C-code, edit the file
and compile it with the Monte-Carlo integration routine.

But suppose I'm too lazy to do this print/edit/compile cycle.
I just want to do in ONE program
 a) calculate the function by symbolic manipulations
 b) evaluate f a few thousand times.

This will certainly be never as fast (in CPU time) as the
print/edit/compile method, but if the additional CPU time is of the same
size as the time I would need to edit and compile the thing, it would be
more convenient.

For point b) double precision would be more than enough.
Now at the moment, some functions are evaluated in CLN
with arbitrary precision. This is probably overkill.

Worse, some functions (like tgamma) do not have a numerical evaluation
at all at the moment.


To implement a numerical evaluation for these functions to arbitrary
precission requires a fair amount of work, but for double precision
algorithms are likely to exist (for example the GNU Scientific Library).

My suggestion would therefore be,

-that class numeric gets a status flag, which signifies "only interested
in double precision"

- and class function gets a pointer "evalf_with_double_precision", which
points to the user-supplied evaluation routine.


 What do you think ?


   Best wishes,

               Stefan










More information about the GiNaC-devel mailing list