Example #1
0
def test_dmp_ground_nth():
    assert dmp_ground_nth([[1],[2],[3]], (0,0), 1, ZZ) == 3
    assert dmp_ground_nth([[1],[2],[3]], (1,0), 1, ZZ) == 2
    assert dmp_ground_nth([[1],[2],[3]], (2,0), 1, ZZ) == 1

    assert dmp_ground_nth([[1],[2],[3]], (2,1), 1, ZZ) == 0
    assert dmp_ground_nth([[1],[2],[3]], (3,0), 1, ZZ) == 0

    raises(IndexError, 'dmp_ground_nth([[3],[4],[5]], (2,-1), 1, ZZ)')
Example #2
0
 def nth(f, *N):
     """Returns the `n`-th coefficient of `f`. """
     if all(isinstance(n, int) for n in N):
         return dmp_ground_nth(f.rep, N, f.lev, f.dom)
     else:
         raise TypeError("a sequence of integers expected")
Example #3
0
 def nth(f, *N):
     """Returns the `n`-th coefficient of `f`. """
     if all(isinstance(n, int) for n in N):
         return dmp_ground_nth(f.rep, N, f.lev, f.dom)
     else:
         raise TypeError("a sequence of integers expected")