Factorization of exponents in Maxima

38 Views Asked by At

I would like Maxima to perform factor in exponents of all exponentials in my expression.

For example,

(%i1) F: exp(-(a + b)^2) + exp(-(c + d)^2)$
(%i2) G: expand(F);

produces

                       2             2         2             2
                   (- d ) - 2 c d - c      (- b ) - 2 a b - a
(%o2)            %e                    + %e

but none of factor(G), radcan(G) or gcfac(G) takes me back to the original expression F. Is there a way how to convert G to F?

1

There are 1 best solutions below

0
Raymond Toy On

Here's one way:

(%i32) map(lambda([z], scanmap(factor,z)), G);

                                     2              2
                            - (d + c)      - (b + a)
(%o32)                    %e           + %e

I figured this out by using scanmap on the first term, and then using map to do this for each of the terms in G.

Not sure how general this approach is.