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?
Here's one way:
I figured this out by using
scanmapon the first term, and then usingmapto do this for each of the terms inG.Not sure how general this approach is.