Hello, there is something severely wrong performance wise with subs and or eval in ginac. Suppose I want to expand 1/(a+sqrt(b*b+x*x)) in a power series in x around x==1 and then substitute numerical values (floating point) for a, b and x. Doing this straight forwardly with series(), series_to_poly() and subs() [program 1] needs 0.01 seconds for series and series_to_poly and 15.99 seconds for subs. However, if I define my own functions f1(x)->1/x and f2 (x)->sqrt(x) using DECLARE_FUNCTION_1P and REGISTER_FUNCTION with the only function options being evalf_func and derivative_func [program 2], it takes 0.09 seconds to do series() and series_to_poly() and 0.02 seconds for the subs()! I suspect, that ginac somehow tries to restructure the expression on a large scale, since if I insert an expand() in the first case between series_to_poly() and subs() [program 3], it takes 15.99 seconds to do the expand() and only 0.12 seconds for the subs(). I have used ginac-version 1.2.4-1 on debian sarge. Attached to this Email You find the source code for my program. Please ask if You have any questions. Regards Frieder Kalisch -- Frieder Kalisch Institut für theoretische Physik kalisch@tphys.uni-heidelberg.de Philosophenweg 19 +49-6221-549-433 D-69120 Heidelberg
participants (1)
-
Frieder Kalisch