slowness is repeated Maxima evaluations?



Hi:

This is an email about an issue that arose on the Sage developers
list involving repeated calls to Maxima. (Sage includes Maxima for
some symbolic computing.) I'm emailing this list to see if this is
(a) a known issue,
(b) an unknown bug, or
(c) an issue with the Sage-Maxima interface and not with Maxima at all.

Here is the problem. Sage is symbolically computing a partial sum of a Fourier
series (ie, a finite trig sum) of a specific piecewise constant function
using Maxima (compiled using clisp).  Then it uses Maxima to do the
point-wise evaluations to create the plot (using matplotlib, not gnuplot).
To be more precise,
(1) Sage calls Maxima and asks it to do lots of definite integrals
(about 30 in this case, each involving a sine or cosine) - these are the
Fourier coefficients,
(2) Sage multiplies each of these coefficients by a sine or cosine function
and adds them up - call this finite sum f(x),
(3) Sage calls Maxima to evaluate f(x) at lots of points to plot the graph
(maybe 100 point-wise evaluations of f(x)),
(4) calls matplotlib to create the plot of f.

This was repeated (for timing purposes) 10 times. In an example involving
about 30 terms, the first took about 10-11 seconds, and repeated
evaluations took longer and longer, with the 10th taking about 30-35 seconds.

Does anyone on this list suspect that it might be a problem in garbage
collecting? Any other ideas? I'm not asking for anyone to spend hours
tracking this down - just was wondering if any of the Maxima developers
might have seen something like this or maybe have a suggestion where to
look.

Thanks, David Joyner