Ejemplo n.º 1
0
def test_zzx_hensel_lift():
    f = zzx_from_dict({4:1, 0:-1})

    f1 = zzx_from_dict({1:1, 0:-1})
    f2 = zzx_from_dict({1:1, 0:-2})
    f3 = zzx_from_dict({1:1, 0: 2})
    f4 = zzx_from_dict({1:1, 0: 1})

    ff_list = zzx_hensel_lift(5, f, [f1, f2, f3, f4], 4)

    assert zzx_to_dict(ff_list[0]) == {0: -1,   1: 1}
    assert zzx_to_dict(ff_list[1]) == {0: -182, 1: 1}
    assert zzx_to_dict(ff_list[2]) == {0:  182, 1: 1}
    assert zzx_to_dict(ff_list[3]) == {0:  1,   1: 1}
Ejemplo n.º 2
0
def test_zzx_hensel_lift():
    f = zzx_from_dict({4: 1, 0: -1})

    f1 = zzx_from_dict({1: 1, 0: -1})
    f2 = zzx_from_dict({1: 1, 0: -2})
    f3 = zzx_from_dict({1: 1, 0: 2})
    f4 = zzx_from_dict({1: 1, 0: 1})

    ff_list = zzx_hensel_lift(5, f, [f1, f2, f3, f4], 4)

    assert zzx_to_dict(ff_list[0]) == {0: -1, 1: 1}
    assert zzx_to_dict(ff_list[1]) == {0: -182, 1: 1}
    assert zzx_to_dict(ff_list[2]) == {0: 182, 1: 1}
    assert zzx_to_dict(ff_list[3]) == {0: 1, 1: 1}
Ejemplo n.º 3
0
def test_zzx_from_to():
    assert zzx_from_dict({}) == []

    f = [3,0,0,2,0,0,0,0,8]

    g = {8: 3, 5: 2, 0: 8}

    assert zzx_from_dict(g) == f
    assert zzx_to_dict(f) == g

    g = (3*x**8 + 2*x**5 + 8).as_poly(x)

    assert zzx_from_poly(g) == f
    assert zzx_to_poly(f, x) == g
Ejemplo n.º 4
0
def test_zzx_from_to():
    assert zzx_from_dict({}) == []

    f = [3, 0, 0, 2, 0, 0, 0, 0, 8]

    g = {8: 3, 5: 2, 0: 8}

    assert zzx_from_dict(g) == f
    assert zzx_to_dict(f) == g

    g = (3 * x**8 + 2 * x**5 + 8).as_poly(x)

    assert zzx_from_poly(g) == f
    assert zzx_to_poly(f, x) == g
Ejemplo n.º 5
0
def test_zzx_from_to_dict():
    f = {8: 3, 5: 2, 0: 8}
    g = [3,0,0,2,0,0,0,0,8]

    assert zzx_from_dict(f) == g
    assert zzx_to_dict(g) == f
Ejemplo n.º 6
0
def test_zzx_from_to_dict():
    f = {8: 3, 5: 2, 0: 8}
    g = [3, 0, 0, 2, 0, 0, 0, 0, 8]

    assert zzx_from_dict(f) == g
    assert zzx_to_dict(g) == f