[sage-devel] GiNaC as the symbolic manipulation engine in Sage



-----maxima-bounces at math.utexas.edu wrote: -----

>In the case of the summation problem mentioned in this thread,
>the central problem is that Maxima's simplification algorithm
>for the result (something of the form (x + y)^2 + (x + y)^4 + ...)
>seems to run in n^2 time where n is the number of terms.

Simplus doesn't take advantage of sorting (sorting places common
terms next to each other); so

(%i2) tree_reduce("+", makelist((x+y)^(2*i),i,1,10000))$
Evaluation took 0.4000 seconds (0.4000 elapsed)

Here's a simple alternative simplus that makes xreduce faster
than tree_reduce for this sum: (simplus-prosaic is not in Maxima)

(%i3) load("/mysimp/simplus-prosaic.o")$

(%i4) xreduce("+", makelist((x+y)^(2*i),i,1,10000))$
Evaluation took 0.3700 seconds (0.3700 elapsed)

Back to a fresh maxima:

(%i3) xreduce("+", makelist((x+y)^(2*i),i,1,10000))$
Evaluation took 31.5000 seconds (31.5000 elapsed)


Barton