On 2013-02-05, Peter Pfannenschmid <peter.pfannenschmid at guido-kuebler-gmbh.de> wrote:
> (%i1) my_expression: (((T02*T04*(1-K)^4))+(Z^2*(1+T02*T04)))^3;
> 2 4 3
> (%o1) ((T02 T04 + 1) Z + (1 - K) T02 T04)
> (%i2) HasFactor(expr):=(denom(expr/(T02*T04)) = 1)$
> (%i3) matchdeclare(pattern, HasFactor)$
> (%i4) defrule(r_Replace, pattern, T24*(pattern/(T02*T04)))$
> (%i5) apply1(my_expression, r_Replace);
> 2 4 3
> (%o5) ((T24 + 1) Z + (1 - K) T24)
> (%i6)
Peter, thanks for following up. That makes sense to me. Glad to hear
that you got something to work. Maybe others can use the same approach.
best,
Robert Dodier