finding subterms in a bigger term



>
> On Monday 17 September 2007, Stavros Macrakis wrote:
> How did you determine the 5 in the for loop, can't this be done
> automatically?
>
> > You can write a loop do this systematically, e.g.
> >
> >         substabn(ex):=
> >           block([newex],
> >             for i: 1 thru 5 do
> >              while denom(newex: ex*(a+b+i)!/((a+b+i)*(a+b+i-1)!))=1
> >                    do ex:newex,
> >             ex)
>

Everything can be generalized arbitrarily and done automatically. How much
do you want to generalize?  Do you want to convert (XX+1)*XX! => (XX+1)! for
all XX, or only for XX of the form a+b+<integer>?  I was just giving the
sketch of a solution.

You might think that this sort of thing could be done using the pattern
matcher, but I don't think it can -- at least not straightforwardly.  RJF
may have some thoughts on this.

           -s