# [Maxima] patterns for integration

Raymond Toy toy.raymond at gmail.com
Sat Mar 22 20:41:10 CDT 2008

```Robert Marik wrote:
>
> Question 1.
> I have the following to check is a function is polynomial times
> exponential function:
>
> polynomialpx(e):=polynomialp(e,[maw_var]) and hipow(e,maw_var)>0;
> nonzero_constant(e):=constantp(e) and (e#0);
> matchdeclare(pp1,polynomialpx,aa1,nonzero_constant,bb1,constantp);
> defmatch(polexp,pp1*exp(aa1*maw_var+bb1));
>
> (maw_var is variable)
> Is it possible to modify it to match the pattern
> "polynomial*f(a*x+b)" where f is sin, cos or exp ?
> I can write three rules for exp, sin and cos separately, but is it
> possible to do this in one defmatch?
> This can be used to detect, if a function is suitable for integration
> by parts and the polynomial is differentiated
>
>
>
> Question 2.
>
> How to check that a function is in the form R(sin(x),cos(x)) and odd
> with respect to sin(x)   (i.e. the substitution cos(x)=t converts the
> integral into integral of rational function)?
>
> How to check that the function is in the form R(x,sqrt(a*x+b)) (i.e.
> the substitution ax+b=t^2 simplifies the integral into integral of
> rational function)?
>
> Here R(x,y) is rational function in two variables.
>

I'm not really familiar with Maxima's pattern matching.  But maxima has
another pattern matcher in Lisp that is used quite a bit within the
integration code itself.  It's pretty powerful.  There are also quite a
few routines in the integration code that recognizes lots of things
similar to what you're asking.  I'll have to dig through the code to see
if anything exactly matches your examples.  I think there are.

Ray
```