====================================================================
RationalFunctionSum examples
====================================================================

There are 4 different forms of the sum operator in this domain.
They are variations of the types of the input

   sum(i::Polynomial(Integer),variable(i=1..n))

          2
        6i  - 6i + 1
        ------------
             12


   sum(i::Fraction(Polynomial(Integer)),i::Symbol)

          2
        6i  - 6i + 1
        ------------
             12


   sum(i,i=1..n)

         2
        n  + n
        ------
           2


   sum(i::Fraction(Polynomial(Integer)),i=1..n)

         2
        n  + n
        ------
           2


We can compute the sum form on part at a time to see what happens.
First, we make a SegmentBinding(Polynomial(Integer)):

   s:=i=1..n

        i= 1..n


We pick out the upper and lower bounds of the segment:

   hiseg:=high(segment(s))

        n


   loseg:=low(segment(s))

        1


We pick out the variable from the segment:

   v:=variable s

        i


We create a polynomial we wish to sum:

   p:=i::Polynomial(Integer)

         i


And we create the sum for that polynomial:

   f:=sum(p,v)

           2
         6i  - 6i + 1
         ------------
              12


The new evaluate it at the upper endpoint:

   t1:=eval(f,v,(1+hiseg))

           2
         6n  + 6n + 1
         ------------
              12

And the lower endpoint:

   t2:=eval(f,v,loseg)

          1
         --
         12


And we take the difference of the endpoints:

   t1-t2

          2
         n  + n
         ------
            2


See Also:
o )show RationalFunctionSum

