示例#1
0
 def Add(expr, assumptions):
     """
     Hermitian + Hermitian  -> Hermitian
     Hermitian + !Hermitian -> !Hermitian
     """
     if expr.is_number:
         return AskRealHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.hermitian)
示例#2
0
 def Add(expr, assumptions):
     """
     Antihermitian + Antihermitian  -> Antihermitian
     Antihermitian + !Antihermitian -> !Antihermitian
     """
     if expr.is_number:
         return AskImaginaryHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.antihermitian)
示例#3
0
 def Add(expr, assumptions):
     """
     Antihermitian + Antihermitian  -> Antihermitian
     Antihermitian + !Antihermitian -> !Antihermitian
     """
     if expr.is_number:
         return AskImaginaryHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.antihermitian)
示例#4
0
文件: sets.py 项目: xivarri/sympy
 def Add(expr, assumptions):
     """
     Real + Real              -> Real
     Real + (Complex & !Real) -> !Real
     """
     if expr.is_number:
         return AskRealHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.real)
示例#5
0
 def Add(expr, assumptions):
     """
     Real + Real              -> Real
     Real + (Complex & !Real) -> !Real
     """
     if expr.is_number:
         return AskRealHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.real)
示例#6
0
 def Add(expr, assumptions):
     """
     Hermitian + Hermitian  -> Hermitian
     Hermitian + !Hermitian -> !Hermitian
     """
     if expr.is_number:
         return AskRealHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.hermitian)
示例#7
0
 def Add(expr, assumptions):
     """
     Integer + Integer       -> Integer
     Integer + !Integer      -> !Integer
     !Integer + !Integer -> ?
     """
     if expr.is_number:
         return AskIntegerHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.integer)
示例#8
0
文件: sets.py 项目: helpin/sympy
 def Add(expr, assumptions):
     """
     Integer + Integer       -> Integer
     Integer + !Integer      -> !Integer
     !Integer + !Integer -> ?
     """
     if expr.is_number:
         return AskIntegerHandler._number(expr, assumptions)
     return test_closed_group(expr, assumptions, Q.integer)
示例#9
0
文件: sets.py 项目: helpin/sympy
 def Add(expr, assumptions):
     """
     Rational + Rational     -> Rational
     Rational + !Rational    -> !Rational
     !Rational + !Rational   -> ?
     """
     if expr.is_number:
         if expr.as_real_imag()[1]:
             return False
     return test_closed_group(expr, assumptions, Q.rational)
示例#10
0
 def Add(expr, assumptions):
     """
     Rational + Rational     -> Rational
     Rational + !Rational    -> !Rational
     !Rational + !Rational   -> ?
     """
     if expr.is_number:
         if expr.as_real_imag()[1]:
             return False
     return test_closed_group(expr, assumptions, Q.rational)
示例#11
0
 def MatAdd(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.complex_elements)
示例#12
0
 def MatAdd(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.integer_elements)
示例#13
0
文件: sets.py 项目: helpin/sympy
 def Mul(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.algebraic)
示例#14
0
文件: sets.py 项目: helpin/sympy
 def Add(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.complex)
示例#15
0
文件: sets.py 项目: helpin/sympy
 def Add(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.extended_real)
示例#16
0
 def Mul(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.algebraic)
示例#17
0
def _(expr, assumptions):
    return test_closed_group(expr, assumptions, Q.real_elements)
示例#18
0
 def Add(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.complex)
示例#19
0
文件: matrices.py 项目: Lenqth/sympy
def MatMul_elements(matrix_predicate, scalar_predicate, expr, assumptions):
    d = sift(expr.args, lambda x: isinstance(x, MatrixExpr))
    factors, matrices = d[False], d[True]
    return fuzzy_and([
        test_closed_group(Basic(*factors), assumptions, scalar_predicate),
        test_closed_group(Basic(*matrices), assumptions, matrix_predicate)])
示例#20
0
def MatMul_elements(matrix_predicate, scalar_predicate, expr, assumptions):
    d = sift(expr.args, lambda x: isinstance(x, MatrixExpr))
    factors, matrices = d[False], d[True]
    return fuzzy_and(
        test_closed_group(Basic(*factors), assumptions, scalar_predicate),
        test_closed_group(Basic(*matrices), assumptions, matrix_predicate))
示例#21
0
 def Add(expr, assumptions):
     return test_closed_group(expr, assumptions, Q.extended_real)