当前位置: 首页>>代码示例>>Python>>正文


Python Q.complex方法代码示例

本文整理汇总了Python中sympy.assumptions.Q.complex方法的典型用法代码示例。如果您正苦于以下问题:Python Q.complex方法的具体用法?Python Q.complex怎么用?Python Q.complex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy.assumptions.Q的用法示例。


在下文中一共展示了Q.complex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_negative

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_negative():
    x, y = symbols('x,y')
    assert ask(Q.negative(x), Q.negative(x)) == True
    assert ask(Q.negative(x), Q.positive(x)) == False
    assert ask(Q.negative(x), ~Q.real(x)) == False
    assert ask(Q.negative(x), Q.prime(x)) == False
    assert ask(Q.negative(x), ~Q.prime(x)) == None

    assert ask(Q.negative(-x), Q.positive(x)) == True
    assert ask(Q.negative(-x), ~Q.positive(x)) == None
    assert ask(Q.negative(-x), Q.negative(x)) == False
    assert ask(Q.negative(-x), Q.positive(x)) == True

    assert ask(Q.negative(x-1), Q.negative(x)) == True
    assert ask(Q.negative(x+y)) == None
    assert ask(Q.negative(x+y), Q.negative(x)) == None
    assert ask(Q.negative(x+y), Q.negative(x) & Q.negative(y)) == True

    assert ask(Q.negative(x**2)) == None
    assert ask(Q.negative(x**2), Q.real(x)) == False
    assert ask(Q.negative(x**1.4), Q.real(x)) == None

    assert ask(Q.negative(x*y)) == None
    assert ask(Q.negative(x*y), Q.positive(x) & Q.positive(y)) == False
    assert ask(Q.negative(x*y), Q.positive(x) & Q.negative(y)) == True
    assert ask(Q.negative(x*y), Q.complex(x) & Q.complex(y)) == None

    assert ask(Q.negative(x**y)) == None
    assert ask(Q.negative(x**y), Q.negative(x) & Q.even(y)) == False
    assert ask(Q.negative(x**y), Q.negative(x) & Q.odd(y)) == True
    assert ask(Q.negative(x**y), Q.positive(x) & Q.integer(y)) == False

    assert ask(Q.negative(Abs(x))) == False
开发者ID:lazovich,项目名称:sympy,代码行数:35,代码来源:test_query.py

示例2: test_float_1

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_float_1():
    z = 1.0
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == True
    assert ask(Q.rational(z))         == True
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == False
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == True
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == True

    z = 7.2123
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == True
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == False
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False
开发者ID:lazovich,项目名称:sympy,代码行数:36,代码来源:test_query.py

示例3: test_I

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_I():
    I = S.ImaginaryUnit
    z = I
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == False
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == False
    assert ask(Q.imaginary(z))        == True
    assert ask(Q.positive(z))         == False
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False

    z = 1 + I
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == False
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == False
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == False
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False

    z = I*(1+I)
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == False
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == False
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == False
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False
开发者ID:lazovich,项目名称:sympy,代码行数:54,代码来源:test_query.py

示例4: test_real

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_real():
    x, y = symbols('x,y')
    assert ask(Q.real(x)) == None
    assert ask(Q.real(x), Q.real(x)) == True
    assert ask(Q.real(x), Q.nonzero(x)) == True
    assert ask(Q.real(x), Q.positive(x)) == True
    assert ask(Q.real(x), Q.negative(x)) == True
    assert ask(Q.real(x), Q.integer(x)) == True
    assert ask(Q.real(x), Q.even(x)) == True
    assert ask(Q.real(x), Q.prime(x)) == True

    assert ask(Q.real(x/sqrt(2)), Q.real(x)) == True
    assert ask(Q.real(x/sqrt(-2)), Q.real(x)) == False

    I = S.ImaginaryUnit
    assert ask(Q.real(x+1), Q.real(x)) == True
    assert ask(Q.real(x+I), Q.real(x)) == False
    assert ask(Q.real(x+I), Q.complex(x)) == None

    assert ask(Q.real(2*x), Q.real(x)) == True
    assert ask(Q.real(I*x), Q.real(x)) == False
    assert ask(Q.real(I*x), Q.imaginary(x)) == True
    assert ask(Q.real(I*x), Q.complex(x)) == None

    assert ask(Q.real(x**2), Q.real(x)) == True
    assert ask(Q.real(sqrt(x)), Q.negative(x)) == False
    assert ask(Q.real(x**y), Q.real(x) & Q.integer(y)) == True
    assert ask(Q.real(x**y), Q.real(x) & Q.real(y)) == None
    assert ask(Q.real(x**y), Q.positive(x) & Q.real(y)) == True

    # trigonometric functions
    assert ask(Q.real(sin(x))) == None
    assert ask(Q.real(cos(x))) == None
    assert ask(Q.real(sin(x)), Q.real(x)) == True
    assert ask(Q.real(cos(x)), Q.real(x)) == True

    # exponential function
    assert ask(Q.real(exp(x))) == None
    assert ask(Q.real(exp(x)), Q.real(x)) == True
    assert ask(Q.real(x + exp(x)), Q.real(x)) == True

    # Q.complexes
    assert ask(Q.real(re(x))) == True
    assert ask(Q.real(im(x))) == True
开发者ID:lazovich,项目名称:sympy,代码行数:46,代码来源:test_query.py

示例5: test_imaginary

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_imaginary():
    x, y, z = symbols('x,y,z')
    I = S.ImaginaryUnit
    assert ask(Q.imaginary(x)) == None
    assert ask(Q.imaginary(x), Q.real(x)) == False
    assert ask(Q.imaginary(x), Q.prime(x)) == False

    assert ask(Q.imaginary(x+1), Q.real(x)) == False
    assert ask(Q.imaginary(x+1), Q.imaginary(x)) == False
    assert ask(Q.imaginary(x+I), Q.real(x)) == False
    assert ask(Q.imaginary(x+I), Q.imaginary(x)) == True
    assert ask(Q.imaginary(x+y), Q.imaginary(x) & Q.imaginary(y)) == True
    assert ask(Q.imaginary(x+y), Q.real(x) & Q.real(y)) == False
    assert ask(Q.imaginary(x+y), Q.imaginary(x) & Q.real(y)) == False
    assert ask(Q.imaginary(x+y), Q.complex(x) & Q.real(y)) == None

    assert ask(Q.imaginary(I*x), Q.real(x)) == True
    assert ask(Q.imaginary(I*x), Q.imaginary(x)) == False
    assert ask(Q.imaginary(I*x), Q.complex(x)) == None
    assert ask(Q.imaginary(x*y), Q.imaginary(x) & Q.real(y)) == True

    assert ask(Q.imaginary(x+y+z), Q.real(x) & Q.real(y) & Q.real(z)) == False
    assert ask(Q.imaginary(x+y+z), Q.real(x) & Q.real(y) & Q.imaginary(z)) == None
    assert ask(Q.imaginary(x+y+z), Q.real(x) & Q.imaginary(y) & Q.imaginary(z)) == False
开发者ID:lazovich,项目名称:sympy,代码行数:26,代码来源:test_query.py

示例6: test_bounded

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_bounded():
    x, y = symbols('x,y')
    assert ask(Q.bounded(x)) == False
    assert ask(Q.bounded(x), Q.bounded(x)) == True
    assert ask(Q.bounded(x), Q.bounded(y)) == False
    assert ask(Q.bounded(x), Q.complex(x)) == False

    assert ask(Q.bounded(x+1)) == False
    assert ask(Q.bounded(x+1), Q.bounded(x)) == True
    assert ask(Q.bounded(x+y)) == None
    assert ask(Q.bounded(x+y), Q.bounded(x)) == False
    assert ask(Q.bounded(x+1), Q.bounded(x) & Q.bounded(y)) == True

    assert ask(Q.bounded(2*x)) == False
    assert ask(Q.bounded(2*x), Q.bounded(x)) == True
    assert ask(Q.bounded(x*y)) == None
    assert ask(Q.bounded(x*y), Q.bounded(x)) == False
    assert ask(Q.bounded(x*y), Q.bounded(x) & Q.bounded(y)) == True

    assert ask(Q.bounded(x**2)) == False
    assert ask(Q.bounded(2**x)) == False
    assert ask(Q.bounded(2**x), Q.bounded(x)) == True
    assert ask(Q.bounded(x**x)) == False
    assert ask(Q.bounded(Rational(1,2) ** x)) == None
    assert ask(Q.bounded(Rational(1,2) ** x), Q.positive(x)) == True
    assert ask(Q.bounded(Rational(1,2) ** x), Q.negative(x)) == False
    assert ask(Q.bounded(sqrt(x))) == False

    # sign function
    assert ask(Q.bounded(sign(x))) == True
    assert ask(Q.bounded(sign(x)), ~Q.bounded(x)) == True

    # exponential functions
    assert ask(Q.bounded(log(x))) == False
    assert ask(Q.bounded(log(x)), Q.bounded(x)) == True
    assert ask(Q.bounded(exp(x))) == False
    assert ask(Q.bounded(exp(x)), Q.bounded(x)) == True
    assert ask(Q.bounded(exp(2))) == True

    # trigonometric functions
    assert ask(Q.bounded(sin(x))) == True
    assert ask(Q.bounded(sin(x)), ~Q.bounded(x)) == True
    assert ask(Q.bounded(cos(x))) == True
    assert ask(Q.bounded(cos(x)), ~Q.bounded(x)) == True
    assert ask(Q.bounded(2*sin(x))) == True
    assert ask(Q.bounded(sin(x)**2)) == True
    assert ask(Q.bounded(cos(x)**2)) == True
    assert ask(Q.bounded(cos(x) + sin(x))) == True
开发者ID:lazovich,项目名称:sympy,代码行数:50,代码来源:test_query.py

示例7: test_zero_0

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_zero_0():
    z = Integer(0)
    assert ask(Q.nonzero(z))          == False
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == True
    assert ask(Q.rational(z))         == True
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == False
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == True
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == True
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False
开发者ID:lazovich,项目名称:sympy,代码行数:19,代码来源:test_query.py

示例8: test_E

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_E():
    z = S.Exp1
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False
开发者ID:lazovich,项目名称:sympy,代码行数:19,代码来源:test_query.py

示例9: test_Rational_number

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_Rational_number():
    r = Rational(3,4)
    assert ask(Q.commutative(r))      == True
    assert ask(Q.integer(r))          == False
    assert ask(Q.rational(r))         == True
    assert ask(Q.real(r))             == True
    assert ask(Q.complex(r))          == True
    assert ask(Q.irrational(r))       == False
    assert ask(Q.imaginary(r))        == False
    assert ask(Q.positive(r))         == True
    assert ask(Q.negative(r))         == False
    assert ask(Q.even(r))             == False
    assert ask(Q.odd(r))              == False
    assert ask(Q.bounded(r))          == True
    assert ask(Q.infinitesimal(r))    == False
    assert ask(Q.prime(r))            == False
    assert ask(Q.composite(r))        == False

    r = Rational(1,4)
    assert ask(Q.positive(r))         == True
    assert ask(Q.negative(r))         == False

    r = Rational(5,4)
    assert ask(Q.negative(r))         == False
    assert ask(Q.positive(r))         == True

    r = Rational(5,3)
    assert ask(Q.positive(r))         == True
    assert ask(Q.negative(r))         == False

    r = Rational(-3,4)
    assert ask(Q.positive(r))         == False
    assert ask(Q.negative(r))         == True

    r = Rational(-1,4)
    assert ask(Q.positive(r))         == False
    assert ask(Q.negative(r))         == True

    r = Rational(-5,4)
    assert ask(Q.negative(r))         == True
    assert ask(Q.positive(r))         == False

    r = Rational(-5,3)
    assert ask(Q.positive(r))         == False
    assert ask(Q.negative(r))         == True
开发者ID:lazovich,项目名称:sympy,代码行数:47,代码来源:test_query.py

示例10: test_nan

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_nan():
    nan = S.NaN
    assert ask(Q.commutative(nan))   == True
    assert ask(Q.integer(nan))       == False
    assert ask(Q.rational(nan))      == False
    assert ask(Q.real(nan))          == False
    assert ask(Q.extended_real(nan)) == False
    assert ask(Q.complex(nan))       == False
    assert ask(Q.irrational(nan))    == False
    assert ask(Q.imaginary(nan))     == False
    assert ask(Q.positive(nan))      == False
    assert ask(Q.nonzero(nan))       == True
    assert ask(Q.even(nan))          == False
    assert ask(Q.odd(nan))           == False
    assert ask(Q.bounded(nan))       == False
    assert ask(Q.infinitesimal(nan)) == False
    assert ask(Q.prime(nan))         == False
    assert ask(Q.composite(nan))     == False
开发者ID:lazovich,项目名称:sympy,代码行数:20,代码来源:test_query.py

示例11: test_neg_infinity

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_neg_infinity():
    mm = S.NegativeInfinity
    assert ask(Q.commutative(mm))    == True
    assert ask(Q.integer(mm))        == False
    assert ask(Q.rational(mm))       == False
    assert ask(Q.real(mm))           == False
    assert ask(Q.extended_real(mm))  == True
    assert ask(Q.complex(mm))        == False
    assert ask(Q.irrational(mm))     == False
    assert ask(Q.imaginary(mm))      == False
    assert ask(Q.positive(mm))       == False
    assert ask(Q.negative(mm))       == True
    assert ask(Q.even(mm))           == False
    assert ask(Q.odd(mm))            == False
    assert ask(Q.bounded(mm))        == False
    assert ask(Q.infinitesimal(mm))  == False
    assert ask(Q.prime(mm))          == False
    assert ask(Q.composite(mm))      == False
开发者ID:lazovich,项目名称:sympy,代码行数:20,代码来源:test_query.py

示例12: test_infinity

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_infinity():
    oo = S.Infinity
    assert ask(Q.commutative(oo))     == True
    assert ask(Q.integer(oo))         == False
    assert ask(Q.rational(oo))        == False
    assert ask(Q.real(oo))            == False
    assert ask(Q.extended_real(oo))   == True
    assert ask(Q.complex(oo))         == False
    assert ask(Q.irrational(oo))      == False
    assert ask(Q.imaginary(oo))       == False
    assert ask(Q.positive(oo))        == True
    assert ask(Q.negative(oo))        == False
    assert ask(Q.even(oo))            == False
    assert ask(Q.odd(oo))             == False
    assert ask(Q.bounded(oo))         == False
    assert ask(Q.infinitesimal(oo))   == False
    assert ask(Q.prime(oo))           == False
    assert ask(Q.composite(oo))       == False
开发者ID:lazovich,项目名称:sympy,代码行数:20,代码来源:test_query.py

示例13: test_commutative

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_commutative():
    """By default objects are Q.commutative that is why it returns True
    for both key=True and key=False"""
    x, y = symbols('x,y')
    assert ask(Q.commutative(x)) == True
    assert ask(Q.commutative(x), ~Q.commutative(x)) == False
    assert ask(Q.commutative(x), Q.complex(x)) == True
    assert ask(Q.commutative(x), Q.imaginary(x)) == True
    assert ask(Q.commutative(x), Q.real(x)) == True
    assert ask(Q.commutative(x), Q.positive(x)) == True
    assert ask(Q.commutative(x), ~Q.commutative(y))  == True

    assert ask(Q.commutative(2*x)) == True
    assert ask(Q.commutative(2*x), ~Q.commutative(x)) == False

    assert ask(Q.commutative(x + 1)) == True
    assert ask(Q.commutative(x + 1), ~Q.commutative(x)) == False

    assert ask(Q.commutative(x**2)) == True
    assert ask(Q.commutative(x**2), ~Q.commutative(x)) == False

    assert ask(Q.commutative(log(x))) == True
开发者ID:lazovich,项目名称:sympy,代码行数:24,代码来源:test_query.py

示例14: test_complex

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_complex():
    x, y = symbols('x,y')
    assert ask(Q.complex(x)) == None
    assert ask(Q.complex(x), Q.complex(x)) == True
    assert ask(Q.complex(x), Q.complex(y)) == None
    assert ask(Q.complex(x), ~Q.complex(x)) == False
    assert ask(Q.complex(x), Q.real(x)) == True
    assert ask(Q.complex(x), ~Q.real(x)) == None
    assert ask(Q.complex(x), Q.rational(x)) == True
    assert ask(Q.complex(x), Q.irrational(x)) == True
    assert ask(Q.complex(x), Q.positive(x)) == True
    assert ask(Q.complex(x), Q.imaginary(x)) == True

    # a+b
    assert ask(Q.complex(x+1), Q.complex(x)) == True
    assert ask(Q.complex(x+1), Q.real(x)) == True
    assert ask(Q.complex(x+1), Q.rational(x)) == True
    assert ask(Q.complex(x+1), Q.irrational(x)) == True
    assert ask(Q.complex(x+1), Q.imaginary(x)) == True
    assert ask(Q.complex(x+1), Q.integer(x))  == True
    assert ask(Q.complex(x+1), Q.even(x))  == True
    assert ask(Q.complex(x+1), Q.odd(x))  == True
    assert ask(Q.complex(x+y), Q.complex(x) & Q.complex(y)) == True
    assert ask(Q.complex(x+y), Q.real(x) & Q.imaginary(y)) == True

    # a*x +b
    assert ask(Q.complex(2*x+1), Q.complex(x)) == True
    assert ask(Q.complex(2*x+1), Q.real(x)) == True
    assert ask(Q.complex(2*x+1), Q.positive(x)) == True
    assert ask(Q.complex(2*x+1), Q.rational(x)) == True
    assert ask(Q.complex(2*x+1), Q.irrational(x)) == True
    assert ask(Q.complex(2*x+1), Q.imaginary(x)) == True
    assert ask(Q.complex(2*x+1), Q.integer(x))  == True
    assert ask(Q.complex(2*x+1), Q.even(x))  == True
    assert ask(Q.complex(2*x+1), Q.odd(x))  == True

    # x**2
    assert ask(Q.complex(x**2), Q.complex(x)) == True
    assert ask(Q.complex(x**2), Q.real(x)) == True
    assert ask(Q.complex(x**2), Q.positive(x)) == True
    assert ask(Q.complex(x**2), Q.rational(x)) == True
    assert ask(Q.complex(x**2), Q.irrational(x)) == True
    assert ask(Q.complex(x**2), Q.imaginary(x)) == True
    assert ask(Q.complex(x**2), Q.integer(x))  == True
    assert ask(Q.complex(x**2), Q.even(x))  == True
    assert ask(Q.complex(x**2), Q.odd(x))  == True

    # 2**x
    assert ask(Q.complex(2**x), Q.complex(x)) == True
    assert ask(Q.complex(2**x), Q.real(x)) == True
    assert ask(Q.complex(2**x), Q.positive(x)) == True
    assert ask(Q.complex(2**x), Q.rational(x)) == True
    assert ask(Q.complex(2**x), Q.irrational(x)) == True
    assert ask(Q.complex(2**x), Q.imaginary(x)) == True
    assert ask(Q.complex(2**x), Q.integer(x))  == True
    assert ask(Q.complex(2**x), Q.even(x))  == True
    assert ask(Q.complex(2**x), Q.odd(x))  == True
    assert ask(Q.complex(x**y), Q.complex(x) & Q.complex(y)) == True

    # trigonometric expressions
    assert ask(Q.complex(sin(x))) == True
    assert ask(Q.complex(sin(2*x + 1))) == True
    assert ask(Q.complex(cos(x))) == True
    assert ask(Q.complex(cos(2*x+1))) == True

    # exponential
    assert ask(Q.complex(exp(x))) == True
    assert ask(Q.complex(exp(x))) == True

    # Q.complexes
    assert ask(Q.complex(Abs(x))) == True
    assert ask(Q.complex(re(x))) == True
    assert ask(Q.complex(im(x))) == True
开发者ID:lazovich,项目名称:sympy,代码行数:75,代码来源:test_query.py

示例15: test_pi

# 需要导入模块: from sympy.assumptions import Q [as 别名]
# 或者: from sympy.assumptions.Q import complex [as 别名]
def test_pi():
    z = S.Pi
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False

    z = S.Pi + 1
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False

    z = 2*S.Pi
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False

    z = S.Pi ** 2
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False

    z = (1+S.Pi) ** 2
    assert ask(Q.commutative(z))      == True
    assert ask(Q.integer(z))          == False
    assert ask(Q.rational(z))         == False
    assert ask(Q.real(z))             == True
    assert ask(Q.complex(z))          == True
    assert ask(Q.irrational(z))       == True
    assert ask(Q.imaginary(z))        == False
    assert ask(Q.positive(z))         == True
    assert ask(Q.negative(z))         == False
    assert ask(Q.even(z))             == False
    assert ask(Q.odd(z))              == False
    assert ask(Q.bounded(z))          == True
    assert ask(Q.infinitesimal(z))    == False
    assert ask(Q.prime(z))            == False
    assert ask(Q.composite(z))        == False
开发者ID:lazovich,项目名称:sympy,代码行数:87,代码来源:test_query.py


注:本文中的sympy.assumptions.Q.complex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。