(self, ap, bq, i, z)
Note: i counts from zero!
Note: i counts from zero!
Note : i counts from zero!
def __init__(self, ap, bq, i, z):
        """ Note: i counts from zero! """
        ap, bq, i = list(map(sympify, [ap, bq, i]))

        self._ap = ap
        self._bq = bq
        self._i = i

        ap = list(ap)
        bq = list(bq)
        bi = bq.pop(i) + 1

        if bi == 0:
            raise ValueError('Cannot increment -1 lower index.')

        m = Poly(_x*(bi - 1), _x)
        for b in bq:
            m *= Poly(_x + b - 1, _x)
        #print m

        B = Dummy('B')
        D = Poly((bi - 1)*B - bi + 1, B)
        n = Poly(z, B)
        for a in ap:
            n *= (D + a)
        #print n

        b0 = n.nth(0)
        #print b0
        if b0 == 0:
            raise ValueError('Cannot increment index: cancels with upper')
        #print b0

        n = Poly(Poly(n.all_coeffs()[:-1], B).as_expr().subs(
            B, _x/(bi - 1) + 1), _x)
        #print n

        self._poly = Poly((m - n)/b0, _x)
def __init__ ( self , ap , bq , i , z ) : ap , bq , i = list ( map ( sympify , [ ap , bq , i ] ) ) self . _ap = ap self . _bq = bq self . _i = i ap = list ( ap ) bq = list ( bq ) bi = bq . pop ( i ) + 1 if bi == 0 : raise ValueError ( 'Cannot increment -1 lower index.' ) m = Poly ( _x * ( bi - 1 ) , _x ) for b in bq : m *= Poly ( _x + b - 1 , _x ) #print m B = Dummy ( 'B' ) D = Poly ( ( bi - 1 ) * B - bi + 1 , B ) n = Poly ( z , B ) for a in ap : n *= ( D + a ) #print n b0 = n . nth ( 0 ) #print b0 if b0 == 0 : raise ValueError ( 'Cannot increment index: cancels with upper' ) #print b0 n = Poly ( Poly ( n . all_coeffs ( ) [ : - 1 ] , B ) . as_expr ( ) . subs ( B , _x / ( bi - 1 ) + 1 ) , _x ) #print n self . _poly = Poly ( ( m - n ) / b0 , _x )