(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)
        ai = ap.pop(i) - 1

        if ai == 0:
            raise ValueError('Cannot decrement unit upper index.')

        m = Poly(z*ai, _x)
        for a in ap:
            m *= Poly(_x + a, _x)
        #print m

        A = Dummy('A')
        n = D = Poly(ai*A - ai, A)
        for b in bq:
            n *= (D + b - 1)
        #print n

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

        n = Poly(Poly(n.all_coeffs()[:-1], A).as_expr().subs(A, _x/ai + 1), _x)

        self._poly = Poly((n - m)/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 ) ai = ap . pop ( i ) - 1 if ai == 0 : raise ValueError ( 'Cannot decrement unit upper index.' ) m = Poly ( z * ai , _x ) for a in ap : m *= Poly ( _x + a , _x ) #print m A = Dummy ( 'A' ) n = D = Poly ( ai * A - ai , A ) for b in bq : n *= ( D + b - 1 ) #print n b0 = - n . nth ( 0 ) if b0 == 0 : raise ValueError ( 'Cannot decrement upper index: ' 'cancels with lower' ) #print b0 n = Poly ( Poly ( n . all_coeffs ( ) [ : - 1 ] , A ) . as_expr ( ) . subs ( A , _x / ai + 1 ) , _x ) self . _poly = Poly ( ( n - m ) / b0 , _x )