-----maxima-bounces at math.utexas.edu wrote: -----
>Is it possible to modify it to match the pattern "polynomial*f(a*x+b)"
>where f is sin, cos or exp ?
Let f = p * exp(q), where p and q are polynomials. Then
f' / f = p' / p + q'.
The quotient of divide(f' / f, f) is q'. Try something like:
(%i1) match_to_poly_times_exp_poly(e,x) := block([ee,q,p],
ee : radcan(diff(e,x) / e),
q : integrate(first(divide(ratnumer(ee), ratdenom(ee), x)),x),
p : radcan(e / exp(q)),
if polynomialp(p,[x],lambda([s], freeof(x,s)))
and polynomialp(q,[x], lambda([s], freeof(x,s))) then [p,q] else
false)$
(%i2) match_to_poly_times_exp_poly(x * 7^x,x);
(%o2) [x,log(7)*x]
(%i3) match_to_poly_times_exp_poly((42 + %pi * x + x^9) * exp(x/ z),x);
(%o3) [x^9+%pi*x+42,x/z]
(%i4) match_to_poly_times_exp_poly((1-x)^2 * sqrt(2)^(1+x+x^2),x);
(%o4) [sqrt(2)*x^2-2*sqrt(2)*x+sqrt(2),(log(2)*x^2+log(2)*x)/2]
(%i5) match_to_poly_times_exp_poly(exp(1/x),x);
(%o5) false
(%i19) match_to_poly_times_exp_poly(z * 7^(2*x) + 49^(x+1),x);
(%o19) [z+49,2*log(7)*x]
A similar method that matches to poly * sin(poly) + poly * cos(poly) is
much more difficult,
I think. Also, I'm guessing that match_to_poly_times_exp_poly runs much
more slowly than
a method that walks down the expression tree and looks for exponential
terms.
Barton