[GiNaC-devel] Add method ex::symbols for obtaining all symbols appearing in an expression

Timo Kluck tkluck at infty.nl
Mon Aug 13 01:19:22 CEST 2012


Hi,

You may know the CAS Sage [1] which uses GiNaC. It wraps ginac
expressions in Python, and it adds some extra methods of its own.

One of those methods is variables(), which returns a list of symbols
appearing in the expression. It does so by recursively walking down
the expression tree. At one point, that was a bottle neck in my
algorithm, and I realized that it would be very easy to cache those
variables at construction time from the subexpressions.

I think the natural place to implement such a thing would be in GiNaC
itself, so that everyone (not only sage users) may benefit. Is this
planned and/or would you accept such a patch?

Best regards,
Timo Kluck

[1] www.sagemath.org


More information about the GiNaC-devel mailing list