def test_zzx_diff():
    assert zzx_diff([]) == []
    assert zzx_diff([7]) == []
    assert zzx_diff([2,7]) == [2]
    assert zzx_diff([1,2,1]) == [2,2]
    assert zzx_diff([1,2,3,4]) == [3,4,3]
    assert zzx_diff([1,-1,0,0,2]) == [4,-3,0,0]

    f = [17,34,56,-345,23,76,0,0,12,3,7]

    assert zzx_diff(f, 2) ==                   zzX_diff(zzX_diff(f))
    assert zzx_diff(f, 3) ==          zzX_diff(zzX_diff(zzX_diff(f)))
    assert zzx_diff(f, 4) == zzX_diff(zzX_diff(zzX_diff(zzX_diff(f))))
Esempio n. 2
0
def test_zzx_diff():
    assert zzx_diff([]) == []
    assert zzx_diff([7]) == []
    assert zzx_diff([2, 7]) == [2]
    assert zzx_diff([1, 2, 1]) == [2, 2]
    assert zzx_diff([1, 2, 3, 4]) == [3, 4, 3]
    assert zzx_diff([1, -1, 0, 0, 2]) == [4, -3, 0, 0]

    f = [17, 34, 56, -345, 23, 76, 0, 0, 12, 3, 7]

    assert zzx_diff(f, 2) == zzX_diff(zzX_diff(f))
    assert zzx_diff(f, 3) == zzX_diff(zzX_diff(zzX_diff(f)))
    assert zzx_diff(f, 4) == zzX_diff(zzX_diff(zzX_diff(zzX_diff(f))))
def test_zzX_diff():
    assert zzX_diff([]) == []

    assert zzX_diff([[]]) == [[]]

    assert zzX_diff([[[]]]) == [[[]]]
    assert zzX_diff([[[1], [2]]]) == [[[]]]

    assert zzX_diff([[[1]], [[]]]) == [[[1]]]
    assert zzX_diff([[[3]], [[1]], [[]]]) == [[[6]], [[1]]]

    assert zzX_diff([1,-1,0,0,2]) == [4,-3,0,0]

    f = zzX_from_poly(W_1)

    assert zzX_diff(f, 2) ==                   zzX_diff(zzX_diff(f))
    assert zzX_diff(f, 3) ==          zzX_diff(zzX_diff(zzX_diff(f)))
    assert zzX_diff(f, 4) == zzX_diff(zzX_diff(zzX_diff(zzX_diff(f))))

    assert zzX_diff_for(f, 2, 2) == zzX_swap(zzX_diff(zzX_swap(f, 1, 2), 2), 1, 2)
    assert zzX_diff_for(f, 2, 3) == zzX_swap(zzX_diff(zzX_swap(f, 1, 2), 3), 1, 2)
    assert zzX_diff_for(f, 3, 2) == zzX_swap(zzX_diff(zzX_swap(f, 1, 3), 2), 1, 3)
    assert zzX_diff_for(f, 3, 3) == zzX_swap(zzX_diff(zzX_swap(f, 1, 3), 3), 1, 3)
Esempio n. 4
0
def test_zzX_diff():
    assert zzX_diff([]) == []

    assert zzX_diff([[]]) == [[]]

    assert zzX_diff([[[]]]) == [[[]]]
    assert zzX_diff([[[1], [2]]]) == [[[]]]

    assert zzX_diff([[[1]], [[]]]) == [[[1]]]
    assert zzX_diff([[[3]], [[1]], [[]]]) == [[[6]], [[1]]]

    assert zzX_diff([1, -1, 0, 0, 2]) == [4, -3, 0, 0]

    f = zzX_from_poly(W_1)

    assert zzX_diff(f, 2) == zzX_diff(zzX_diff(f))
    assert zzX_diff(f, 3) == zzX_diff(zzX_diff(zzX_diff(f)))
    assert zzX_diff(f, 4) == zzX_diff(zzX_diff(zzX_diff(zzX_diff(f))))

    assert zzX_diff_for(f, 2, 2) == zzX_swap(zzX_diff(zzX_swap(f, 1, 2), 2), 1,
                                             2)
    assert zzX_diff_for(f, 2, 3) == zzX_swap(zzX_diff(zzX_swap(f, 1, 2), 3), 1,
                                             2)
    assert zzX_diff_for(f, 3, 2) == zzX_swap(zzX_diff(zzX_swap(f, 1, 3), 2), 1,
                                             3)
    assert zzX_diff_for(f, 3, 3) == zzX_swap(zzX_diff(zzX_swap(f, 1, 3), 3), 1,
                                             3)