def test_dup_subresultants(): assert dup_resultant([], [], ZZ) == ZZ(0) assert dup_resultant([ZZ(1)], [], ZZ) == ZZ(0) assert dup_resultant([], [ZZ(1)], ZZ) == ZZ(0) f = dup_normal([1, 0, 1, 0, -3, -3, 8, 2, -5], ZZ) g = dup_normal([3, 0, 5, 0, -4, -9, 21], ZZ) a = dup_normal([15, 0, -3, 0, 9], ZZ) b = dup_normal([65, 125, -245], ZZ) c = dup_normal([9326, -12300], ZZ) d = dup_normal([260708], ZZ) assert dup_subresultants(f, g, ZZ) == [f, g, a, b, c, d] assert dup_resultant(f, g, ZZ) == dup_LC(d, ZZ) f = dup_normal([1, -2, 1], ZZ) g = dup_normal([1, 0, -1], ZZ) a = dup_normal([2, -2], ZZ) assert dup_subresultants(f, g, ZZ) == [f, g, a] assert dup_resultant(f, g, ZZ) == 0 f = dup_normal([1, 0, 1], ZZ) g = dup_normal([1, 0, -1], ZZ) a = dup_normal([-2], ZZ) assert dup_subresultants(f, g, ZZ) == [f, g, a] assert dup_resultant(f, g, ZZ) == 4 f = dup_normal([1, 0, -1], ZZ) g = dup_normal([1, -1, 0, 2], ZZ) assert dup_resultant(f, g, ZZ) == 0 f = dup_normal([3, 0, -1, 0], ZZ) g = dup_normal([5, 0, 1], ZZ) assert dup_resultant(f, g, ZZ) == 64 f = dup_normal([1, -2, 7], ZZ) g = dup_normal([1, 0, -1, 5], ZZ) assert dup_resultant(f, g, ZZ) == 265 f = dup_normal([1, -6, 11, -6], ZZ) g = dup_normal([1, -15, 74, -120], ZZ) assert dup_resultant(f, g, ZZ) == -8640 f = dup_normal([1, -6, 11, -6], ZZ) g = dup_normal([1, -10, 29, -20], ZZ) assert dup_resultant(f, g, ZZ) == 0 f = dup_normal([1, 0, 0, -1], ZZ) g = dup_normal([1, 2, 2, -1], ZZ) assert dup_resultant(f, g, ZZ) == 16 f = dup_normal([1, 0, 0, 0, 0, 0, 0, 0, -2], ZZ) g = dup_normal([1, -1], ZZ) assert dup_resultant(f, g, ZZ) == -1
def test_dup_subresultants(): assert dup_resultant([], [], ZZ) == ZZ(0) assert dup_resultant([ZZ(1)], [], ZZ) == ZZ(0) assert dup_resultant([], [ZZ(1)], ZZ) == ZZ(0) f = dup_normal([1,0,1,0,-3,-3,8,2,-5], ZZ) g = dup_normal([3,0,5,0,-4,-9,21], ZZ) a = dup_normal([15,0,-3,0,9], ZZ) b = dup_normal([65,125,-245], ZZ) c = dup_normal([9326,-12300], ZZ) d = dup_normal([260708], ZZ) assert dup_subresultants(f, g, ZZ) == [f, g, a, b, c, d] assert dup_resultant(f, g, ZZ) == dup_LC(d, ZZ) f = dup_normal([1,-2,1], ZZ) g = dup_normal([1,0,-1], ZZ) a = dup_normal([2,-2], ZZ) assert dup_subresultants(f, g, ZZ) == [f, g, a] assert dup_resultant(f, g, ZZ) == 0 f = dup_normal([1,0, 1], ZZ) g = dup_normal([1,0,-1], ZZ) a = dup_normal([-2], ZZ) assert dup_subresultants(f, g, ZZ) == [f, g, a] assert dup_resultant(f, g, ZZ) == 4 f = dup_normal([1,0,-1], ZZ) g = dup_normal([1,-1,0,2], ZZ) assert dup_resultant(f, g, ZZ) == 0 f = dup_normal([3,0,-1,0], ZZ) g = dup_normal([5,0,1], ZZ) assert dup_resultant(f, g, ZZ) == 64 f = dup_normal([1,-2,7], ZZ) g = dup_normal([1,0,-1,5], ZZ) assert dup_resultant(f, g, ZZ) == 265 f = dup_normal([1,-6,11,-6], ZZ) g = dup_normal([1,-15,74,-120], ZZ) assert dup_resultant(f, g, ZZ) == -8640 f = dup_normal([1,-6,11,-6], ZZ) g = dup_normal([1,-10,29,-20], ZZ) assert dup_resultant(f, g, ZZ) == 0 f = dup_normal([1,0,0,-1], ZZ) g = dup_normal([1,2,2,-1], ZZ) assert dup_resultant(f, g, ZZ) == 16 f = dup_normal([1,0,0,0,0,0,0,0,-2], ZZ) g = dup_normal([1,-1], ZZ) assert dup_resultant(f, g, ZZ) == -1