[GiNaC-list] products of exponentials

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Thu Dec 8 06:53:40 CET 2011


On Wed, Dec 07, 2011 at 04:25:09PM -0800, Levi Boyles wrote:

> >  for any expression b. This one is not easy to do automatically within
> >  GiNaC for various reasons, I think.

As a matter of policy GiNaC applies complex (in the algorithmic sense)
transformations only upon an explicit request. Basically anything more
expensive than O(N^2) is not applied automatically (modulo bugs and some
special cases).

> I don't understand, why this would be hard?

It's not that hard, however doing so makes every eval() slower, even if
the expression being processed does not contain any exponents at all.

> The product of 3 (or more) expressions is already represented as a sequence
> in the "mul" expression type, so couldn't ginac just find all subexpressions
> in the product of type exp, and then collect them?

It's easy to add just one extra little feature to help someone... and then
another...  and another... Eventually these attempts to be too smart get out
of hand, and you can't even input a simple expression
(case in point: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=407109).

> Anyway I will try the subs/wildcard method as you suggested, I didn't think
> of that. 

You might want to use map_function (for more details see

Best regards,

More information about the GiNaC-list mailing list