コード例 #1
0
ファイル: test_euclidtools.py プロジェクト: vperic/sympy
def test_dup_cancel():
    f = ZZ.map([2, 0, -2])
    g = ZZ.map([1, -2, 1])

    p = [ZZ(2), ZZ(2)]
    q = [ZZ(1), -ZZ(1)]

    assert dup_cancel(f, g, ZZ) == (p, q)
    assert dup_cancel(f, g, ZZ, include=False) == (ZZ(1), ZZ(1), p, q)

    f = [-ZZ(1), -ZZ(2)]
    g = [ZZ(3), -ZZ(4)]

    F = [ZZ(1), ZZ(2)]
    G = [-ZZ(3), ZZ(4)]

    assert dup_cancel(f, g, ZZ) == (f, g)
    assert dup_cancel(F, G, ZZ) == (f, g)

    assert dup_cancel([], [], ZZ) == ([], [])
    assert dup_cancel([], [], ZZ, include=False) == (ZZ(1), ZZ(1), [], [])

    assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ) == ([ZZ(1)], [])
    assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ,
                      include=False) == (ZZ(1), ZZ(1), [ZZ(1)], [])

    assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ) == ([], [ZZ(1)])
    assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ,
                      include=False) == (ZZ(1), ZZ(1), [], [ZZ(1)])
コード例 #2
0
def test_dup_cancel():
    f = ZZ.map([2, 0, -2])
    g = ZZ.map([1, -2, 1])

    p = [ZZ(2), ZZ(2)]
    q = [ZZ(1), -ZZ(1)]

    assert dup_cancel(f, g, ZZ) == (p, q)
    assert dup_cancel(f, g, ZZ, include=False) == (ZZ(1), ZZ(1), p, q)

    f = [-ZZ(1), -ZZ(2)]
    g = [ ZZ(3), -ZZ(4)]

    F = [ ZZ(1), ZZ(2)]
    G = [-ZZ(3), ZZ(4)]

    assert dup_cancel(f, g, ZZ) == (f, g)
    assert dup_cancel(F, G, ZZ) == (f, g)

    assert dup_cancel([], [], ZZ) == ([], [])
    assert dup_cancel([], [], ZZ, include=False) == (ZZ(1), ZZ(1), [], [])

    assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ) == ([ZZ(1)], [])
    assert dup_cancel(
        [ZZ(1), ZZ(0)], [], ZZ, include=False) == (ZZ(1), ZZ(1), [ZZ(1)], [])

    assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ) == ([], [ZZ(1)])
    assert dup_cancel(
        [], [ZZ(1), ZZ(0)], ZZ, include=False) == (ZZ(1), ZZ(1), [], [ZZ(1)])
コード例 #3
0
ファイル: test_euclidtools.py プロジェクト: addisonc/sympy
def test_dup_cancel():
    f = ZZ.map([2, 0, -2])
    g = ZZ.map([1, -2, 1])

    p = [ZZ(2), ZZ(2)]
    q = [ZZ(1), -ZZ(1)]

    assert dup_cancel(f, g, ZZ) == (p, q)
    assert dup_cancel(f, g, ZZ, multout=False) == (ZZ(1), ZZ(1), p, q)

    f = [-ZZ(1),-ZZ(2)]
    g = [ ZZ(3),-ZZ(4)]

    F = [ ZZ(1), ZZ(2)]
    G = [-ZZ(3), ZZ(4)]

    dup_cancel(f, g, ZZ) == (f, g)
    dup_cancel(F, G, ZZ) == (f, g)
コード例 #4
0
ファイル: test_euclidtools.py プロジェクト: robotment/sympy
def test_dup_cancel():
    f = ZZ.map([2, 0, -2])
    g = ZZ.map([1, -2, 1])

    p = [ZZ(2), ZZ(2)]
    q = [ZZ(1), -ZZ(1)]

    assert dup_cancel(f, g, ZZ) == (p, q)
    assert dup_cancel(f, g, ZZ, multout=False) == (ZZ(1), ZZ(1), p, q)

    f = [-ZZ(1), -ZZ(2)]
    g = [ZZ(3), -ZZ(4)]

    F = [ZZ(1), ZZ(2)]
    G = [-ZZ(3), ZZ(4)]

    dup_cancel(f, g, ZZ) == (f, g)
    dup_cancel(F, G, ZZ) == (f, g)