コード例 #1
0
def test_dmp_lift():
    q = [QQ(1, 1), QQ(0, 1), QQ(1, 1)]

    f = [
        ANP([QQ(1, 1)], q, QQ),
        ANP([], q, QQ),
        ANP([], q, QQ),
        ANP([QQ(1, 1), QQ(0, 1)], q, QQ),
        ANP([QQ(17, 1), QQ(0, 1)], q, QQ),
    ]

    assert dmp_lift(f, 0, QQ.algebraic_field(I)) == [
        QQ(1),
        QQ(0),
        QQ(0),
        QQ(0),
        QQ(0),
        QQ(0),
        QQ(2),
        QQ(0),
        QQ(578),
        QQ(0),
        QQ(0),
        QQ(0),
        QQ(1),
        QQ(0),
        QQ(-578),
        QQ(0),
        QQ(83521),
    ]

    raises(DomainError, lambda: dmp_lift([EX(1), EX(2)], 0, EX))
コード例 #2
0
ファイル: test_densetools.py プロジェクト: FireJade/sympy
def test_dmp_lift():
    q = [QQ(1, 1), QQ(0, 1), QQ(1, 1)]

    f = [ANP([QQ(1, 1)], q, QQ), ANP([], q, QQ), ANP([], q, QQ),
         ANP([QQ(1, 1), QQ(0, 1)], q, QQ), ANP([QQ(17, 1), QQ(0, 1)], q, QQ)]

    assert dmp_lift(f, 0, QQ.algebraic_field(I)) == \
        [QQ(1), QQ(0), QQ(0), QQ(0), QQ(0), QQ(0), QQ(2), QQ(0), QQ(578),
         QQ(0), QQ(0), QQ(0), QQ(1), QQ(0), QQ(-578), QQ(0), QQ(83521)]

    raises(DomainError, lambda: dmp_lift([EX(1), EX(2)], 0, EX))
コード例 #3
0
ファイル: polyclasses.py プロジェクト: fxkr/sympy
 def lift(f):
     """Convert algebraic coefficients to rationals. """
     return f.per(dmp_lift(f.rep, f.lev, f.dom), dom=f.dom.dom)
コード例 #4
0
 def lift(f):
     """Convert algebraic coefficients to rationals. """
     return f.per(dmp_lift(f.rep, f.lev, f.dom), dom=f.dom.dom)