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

        self._an = an
        self._ap = ap
        self._bm = bm
        self._bq = bq
        self._i = i

        an = list(an)
        ap = list(ap)
        bm = list(bm)
        bq = list(bq)
        ai = an.pop(i) + 1

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

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

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

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

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