size of an expression



I don't see such a program in Maxima.  In Macsyma there
is a program that could be easily written for Maxima, too.
It is described here:

CONS_SIZE(expr)

Returns an integer which is the size of expr in "Macsyma cells".
This is the same as the Lisp cons-size of the expression except that
atomic operators ("+", "*", SIN, F, etc.)  count as 1 even if they
take more than one Lisp cell.  (I.e., "SIMP" flags, etc., on the
operators are ignored.)

CONS_SIZE(atom); is 0 .

CONS_SIZE provides a metric for the complexity of expressions.
Since relative complexity is usually what's important here, the
number CONS_SIZE returns is for the internal representation of the
expression, for the sake of efficiency.  If the CONS_SIZE of the
external representation is desired, CONS_SIZE(DISPFORM(expr,'ALL));
can be used.

See also COMPLEXITY, COUNT_OPS.



Fabrizio Caruso wrote:

> Hi all 
> 
> Is there a Maxima command that tells 
> how many bytes an expression occupies?
> or a command to measure the "size" or 
> "complexity" of an expression in some way 
> other than bytes?
> 
>    Fabrizio
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima