예제 #1
0
def test_polys():
    x = Symbol("X")

    ZZ = PythonIntegerRing()
    QQ = PythonRationalField()

    for c in (Poly, Poly(x, x)):
        check(c)

    for c in (DMP, DMP([[ZZ(1)], [ZZ(2)], [ZZ(3)]], ZZ)):
        check(c)
    for c in (DMF, DMF(([ZZ(1), ZZ(2)], [ZZ(1), ZZ(3)]), ZZ)):
        check(c)
    for c in (ANP, ANP([QQ(1), QQ(2)], [QQ(1), QQ(2), QQ(3)], QQ)):
        check(c)

    for c in (PythonIntegerRing, PythonIntegerRing()):
        check(c)
    for c in (PythonRationalField, PythonRationalField()):
        check(c)

    for c in (PolynomialRing, PolynomialRing(ZZ, 'x', 'y')):
        check(c)
    for c in (FractionField, FractionField(ZZ, 'x', 'y')):
        check(c)

    for c in (ExpressionDomain, ExpressionDomain()):
        check(c)

    from sympy.core.compatibility import HAS_GMPY

    if HAS_GMPY:
        from sympy.polys.domains import GMPYIntegerRing, GMPYRationalField

        for c in (GMPYIntegerRing, GMPYIntegerRing()):
            check(c)
        for c in (GMPYRationalField, GMPYRationalField()):
            check(c)

    f = x**3 + x + 3
    g = exp

    for c in (RootOf, RootOf(f, 0), RootSum, RootSum(f, g)):
        check(c)
예제 #2
0
def test_polys():
    x = Symbol("x")

    ZZ = PythonIntegerRing()
    QQ = SymPyRationalField()

    for c in (Poly, Poly(x, x)):
        check(c)

    for c in (GFP, GFP([ZZ(1), ZZ(2), ZZ(3)], ZZ(7), ZZ)):
        check(c)
    for c in (DMP, DMP([ZZ(1), ZZ(2), ZZ(3)], 0, ZZ)):
        check(c)
    for c in (DMF, DMF(([ZZ(1), ZZ(2)], [ZZ(1), ZZ(3)], ZZ))):
        check(c)
    for c in (ANP, ANP([QQ(1), QQ(2)], [QQ(1), QQ(2), QQ(3)], QQ)):
        check(c)

    for c in (PythonIntegerRing, PythonIntegerRing()):
        check(c)
    for c in (SymPyIntegerRing, SymPyIntegerRing()):
        check(c)
    for c in (SymPyRationalField, SymPyRationalField()):
        check(c)

    for c in (PolynomialRing, PolynomialRing(ZZ, 'x', 'y')):
        check(c)
    for c in (FractionField, FractionField(ZZ, 'x', 'y')):
        check(c)

    for c in (ExpressionDomain, ExpressionDomain()):
        check(c)

    from sympy.polys.domains import HAS_FRACTION, HAS_GMPY

    if HAS_FRACTION:
        from sympy.polys.domains import PythonRationalField

        for c in (PythonRationalField, PythonRationalField()):
            check(c)

    if HAS_GMPY:
        from sympy.polys.domains import GMPYIntegerRing, GMPYRationalField

        for c in (GMPYIntegerRing, GMPYIntegerRing()):
            check(c)
        for c in (GMPYRationalField, GMPYRationalField()):
            check(c)

    f = x**3 + x + 3
    g = lambda x: x

    for c in (RootOf, RootOf(f, 0), RootSum, RootSum(f, g)):
        check(c)
예제 #3
0
 def parent(self):
     from sympy.polys.domains import PythonRationalField
     return PythonRationalField()