# [Maxima] Simplification of infinities

Dieter Kaiser drdieterkaiser at web.de
Mon Dec 7 16:05:46 CST 2009

```Am Montag, den 07.12.2009, 11:38 -0500 schrieb Stavros Macrakis:
> Here's are some simple performance tests that might show some
> differences for the new inf code:
>
> showtime:true\$
> qq: ratsimp((x^50000-1)/(x-1))\$
>
> for i thru 1000 do qq:qq+1\$
> for i thru 1000 do qq:qq+%pi\$
> for i thru 1000 do qq:qq+x\$
> for i thru 1000 do qq:qq+x^50000\$
>
> Or maybe:
>
> determinant(genmatrix(lambda([i,j],x^(i-j)),15,15))\$

I have tried the above examples. In all cases I have not found a
significance difference. I have introduced a flag simpinfinities which
switches off the simplification of infinities.

These are the results for the last example:

(%i2) determinant(genmatrix(lambda([i,j],x^(i-j)),15,15))\$
Evaluation took 179.7592 seconds (180.4697 elapsed) using 18.027 MB.

(%i3) determinant(genmatrix(lambda([i,j],x^(i-j)),15,15)),
simpinfinities:false\$
Evaluation took 179.4352 seconds (180.1552 elapsed) using 18.028 MB.

I have run all examples several times. The difference is always about
0,2 to 0,4 seconds or about 0,2% of increase of runtime for the last
example. For the first four examples from above that is approximately
the time to check about 50000 terms to be free of infinities with the
function intersection. This time is negligible against the time we need
in simplus to add up the 50000 terms.

Therefore, we do not get a significance slow down for expression with a
great number of terms. I think we get a greater effect for many short
expressions like in the testsuite. For the testsuite I have found an
increase of about 0,7% with the code to simplify infinities.

Remark:
We go very often through the function simplifya but not as often through
he simplifying functions like simplus, because of the simp-flag. I think
we can improve the runtime of Maxima more significant if we have a look
at the places were we resimplify unnecessarily. This is an example of
the code of the function \$limit. Here we resimplify two times, first we
expand, then we resimplify:

(setq exp (resimplify
(factosimp
(tansc
(lfibtophi
(limitsimp (\$expand exp 1 0) var))))))

Dieter Kaiser

```