You might consider:
(1) placing the assignment logexpand: super inside a block--your code globally alters logexpand
(2) moving the definition of exp_log_to_power to outside the body of expcontract--the definition of
exp_log_to_power is global--it gets redefined everytime expcontract is called.
And by the way: if you like the leading underscores on variable, that's OK. But for this code, there is
no need to wartify the variable names. Actually, I think that leading underscores makes code harder
to read, and it makes me more likely to make errors (one place _z another z).
--Barton
________________________________________
I have a idea (combined previous)
expcontract(_expr):=block([_z],
exp_log_to_power(_e):= block([_s, logconcoeffp: lambda([_s],true)],
logcontract(_e)),
logexpand: super,
scanmap(lambda([_z],if atom(_z) then _z else (
exp_log_to_power(exp(logcontract(log(_z))))
)),_expr)
)$
expr: x^a*y^a$
expcontract(expr);
-> (x*y)^a
expr: (a^d*b^d+c^a*a^a)/(d^b*e^b+a^b*c^b)$
expcontract(expr);
-> ((a*b)^d+(a*c)^a)/((d*e)^b+(a*c)^b)
Derka
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima