Hi,

is there any (easy) way to get an idea of how complex a given expression is?

I saw that "implementing complexity measures" was among the ideas for
the GSoC2009. I dont know how sophisticated this was planned to be.

My naive approach is the following:

def depth(expr):
    if expr.is_Atom:
        return 0
    else:
        return max(map(depth, expr.args))+1


(I have a tree with many levels of subbranches in mind.)

Any comments?

The background is: I am trying to investigate why expand() hangs or
needs very long time if applied to determinants of polynomial matrices
(just 4-by-4).


Regards,
Bastian

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to