(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)
        bi = bq.pop(i) - 1

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

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

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

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