Yeah, that works too. In this case I think a rule for exp expressions
is actually preferable, since it guarantees factor is not applied
to any other kind of expression.
best
Robert Dodier
On 7/11/12, Richard Fateman <fateman at eecs.berkeley.edu> wrote:
> On 7/11/2012 10:37 PM, 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).
>>
> matchdeclare(h,true);
>
> defrule(r1,exp(h),exp(factor(h));
>
> apply1(f,r1)
>
> results in
>
> %e^(t[3]*(2*x^2+1))
>
>
> It also works on apply1(f+4*f^2,r1)
>
> etc
>
>