[Maxima] Simplification Problem (optimization)

Stavros Macrakis macrakis
Wed Sep 6 15:19:26 CDT 2006


The simplest optimization of shortest_first is to use a hasharray to
cache the results of the length calculation:

    sls[a]:=slength(string(a))$
    shortest_first(s):= sort(args(s),lambda([a,b],sls[a]<sls[b]))$
    translate(shortest_first)$

This improves the time from 45 seconds to 6.

         -s



More information about the Maxima mailing list