finding subterms in a bigger term



Hi Maxima mailinglist,

I'm experimenting with non-classical orthogonal polynomials.

I have set,

gammalim : -2;

because I don't want the gamma function to be evaluated.

I have the constraints
a > -1, a real, and b > -1, b real
but they are not used within my Maxima source at the moment.

I have terms being polynomial in gamma terms like the following

------------------------------------------------------------------------------
(%o13) ((gamma (a + 1) gamma (b + 1) gamma (b + a + 3)
           2             2
 + (- gamma (a + 1) gamma (b + 2) + 2 gamma(a + 1) gamma(a + 2) gamma(b + 1)
                     2             2              2
 gamma(b + 2) - gamma (a + 2) gamma (b + 1)) gamma (b + a + 2))
      2                    2
 gamma (b + a + 4) + (gamma (a + 1) gamma(b + 1) gamma(b + 3)
 - 2 gamma(a + 1) gamma(a + 2) gamma(b + 1) gamma(b + 2)
                                  2                               2
 + gamma(a + 1) gamma(a + 3) gamma (b + 1)) gamma(b + a + 2) gamma (b + a + 3)
 gamma(b + a + 4)) gamma(b + a + 5)
------------------------------------------------------------------------------

Question:

How can I find minimal n1, n2, n3 such that

gamma(a+n1), gamma(b+n2) and gamma(a+b+n3)

are appearing in the above term?

I want to use gamma(x+1) = x*gamma(x)


Regards
Andre