示例#1
0
def test_dmp_pdiv():
    f = dmp_normal([[1], [], [1,0,0]], 1, ZZ)
    g = dmp_normal([[1], [-1,0]], 1, ZZ)

    q = dmp_normal([[1], [1, 0]], 1, ZZ)
    r = dmp_normal([[2, 0, 0]], 1, ZZ)

    assert dmp_pdiv(f, g, 1, ZZ) == (q, r)
    assert dmp_pquo(f, g, 1, ZZ) == q
    assert dmp_prem(f, g, 1, ZZ) == r

    raises(ExactQuotientFailed, lambda: dmp_pexquo(f, g, 1, ZZ))

    f = dmp_normal([[1], [], [1,0,0]], 1, ZZ)
    g = dmp_normal([[2], [-2,0]], 1, ZZ)

    q = dmp_normal([[2], [2, 0]], 1, ZZ)
    r = dmp_normal([[8, 0, 0]], 1, ZZ)

    assert dmp_pdiv(f, g, 1, ZZ) == (q, r)
    assert dmp_pquo(f, g, 1, ZZ) == q
    assert dmp_prem(f, g, 1, ZZ) == r

    raises(ExactQuotientFailed, lambda: dmp_pexquo(f, g, 1, ZZ))
示例#2
0
文件: polyclasses.py 项目: fxkr/sympy
 def pdiv(f, g):
     """Polynomial pseudo-division of `f` and `g`. """
     lev, dom, per, F, G = f.unify(g)
     q, r = dmp_pdiv(F, G, lev, dom)
     return per(q), per(r)
示例#3
0
 def pdiv(f, g):
     """Polynomial pseudo-division of `f` and `g`. """
     lev, dom, per, F, G = f.unify(g)
     q, r = dmp_pdiv(F, G, lev, dom)
     return per(q), per(r)