Thanks for the suggestions; however none of them seem to really do the
trick. Here's a real example:
kill(all);
ansp: xi*((xi^2-k[0]^2)*log((abs(xi-k[0])/(xi+k[0]))^2)+4*k[0]*xi)
/(k[0]*(Gamma+D*(xi^2-k[0]^2)))
*((exp(-D*k[0]^2*(t[0]+t[3]))-exp(-2*Gamma*t[3]-D*k[0]^2*(t[0]-t[3])))
/(Gamma-D*k[0]^2)
+(exp(-Gamma*(t[0]+t[3])-D*xi^2*(t[0]-t[3]))
+exp(-2*Gamma*t[3]-D*k[0]^2*(t[0]-t[3]))
-exp(-D*k[0]^2*t[3]-(D*xi^2+Gamma)*t[0])
-exp(-(Gamma+D*xi^2)*t[3]-D*k[0]^2*t[0]))/(Gamma-D*(xi^2+k[0]^2))
);
f:ratsimp(%);
scanmap(factor, f, bottomup);
scanmap(factor, f);
scanmap(factorsum, f, bottomup);
scanmap(factorsum, f);
matchdeclare(h, true);
defrule(r1, exp(h), exp(factor(h)));
apply1(f, r1);
defrule(r1, exp(h), exp(factorsum(h)));
defrule(r2, log(h), log(factorsum(h)));
apply1(f, r1);
apply1(%, r2);
Note that ansp is what I'd like (I factored f manually to get it).
David
On Thu, 2012-07-12 at 05:37 +0000, Robert Dodier wrote:
> On 2012-07-09, David Ronis <David.Ronis at McGill.CA> wrote:
>
> > I'm trying to factor a fairly messy expression that contains things like
> >
> > f:exp(2*t[3]*x^2+t[3]);
> >
> > (actually linear combinations of things like f).
>
> I tried some examples and factor sometimes pulls exp(...) out of a
> linear combination of exponentials, and the left-over terms don't seem
> to be factorable.
>
> Try scanmap(factor, <stuff>, bottomup) -- that way factor works on the
> exponents first.
>
> In the examples I tried, scanmap and factor seemed to have the expected
> effect, so if you think you've found a bug, maybe you can post some
> specific examples.
>
> best,
>
> Robert Dodier
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>