Sets

Handlers for predicates related to set membership: integer, rational, etc.

class sympy.assumptions.handlers.sets.AskAlgebraicHandler[source]

Handler for Q.algebraic key.

class sympy.assumptions.handlers.sets.AskAntiHermitianHandler[source]

Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian

static Add(expr, assumptions)[source]

Antihermitian + Antihermitian -> Antihermitian Antihermitian + !Antihermitian -> !Antihermitian

static Mul(expr, assumptions)[source]

As long as there is at most only one noncommutative term: Hermitian*Hermitian -> !Antihermitian Hermitian*Antihermitian -> Antihermitian Antihermitian*Antihermitian -> !Antihermitian

static Pow(expr, assumptions)[source]

Hermitian**Integer -> !Antihermitian Antihermitian**Even -> !Antihermitian Antihermitian**Odd -> Antihermitian

class sympy.assumptions.handlers.sets.AskComplexHandler[source]

Handler for Q.complex Test that an expression belongs to the field of complex numbers

class sympy.assumptions.handlers.sets.AskExtendedRealHandler[source]

Handler for Q.extended_real Test that an expression belongs to the field of extended real numbers, that is real numbers union {Infinity, -Infinity}

static Add(expr, assumptions)[source]

Real + Real -> Real Real + (Complex & !Real) -> !Real

static Mul(expr, assumptions)

Real + Real -> Real Real + (Complex & !Real) -> !Real

static Pow(expr, assumptions)

Real + Real -> Real Real + (Complex & !Real) -> !Real

class sympy.assumptions.handlers.sets.AskHermitianHandler[source]

Handler for Q.hermitian Test that an expression belongs to the field of Hermitian operators

static Add(expr, assumptions)[source]

Hermitian + Hermitian -> Hermitian Hermitian + !Hermitian -> !Hermitian

static Mul(expr, assumptions)[source]

As long as there is at most only one noncommutative term: Hermitian*Hermitian -> Hermitian Hermitian*Antihermitian -> !Hermitian Antihermitian*Antihermitian -> Hermitian

static Pow(expr, assumptions)[source]

Hermitian**Integer -> Hermitian

class sympy.assumptions.handlers.sets.AskImaginaryHandler[source]

Handler for Q.imaginary Test that an expression belongs to the field of imaginary numbers, that is, numbers in the form x*I, where x is real

static Add(expr, assumptions)[source]

Imaginary + Imaginary -> Imaginary Imaginary + Complex -> ? Imaginary + Real -> !Imaginary

static Mul(expr, assumptions)[source]

Real*Imaginary -> Imaginary Imaginary*Imaginary -> Real

static Pow(expr, assumptions)[source]

Imaginary**Odd -> Imaginary Imaginary**Even -> Real b**Imaginary -> !Imaginary if exponent is an integer multiple of I*pi/log(b) Imaginary**Real -> ? Positive**Real -> Real Negative**Integer -> Real Negative**(Integer/2) -> Imaginary Negative**Real -> not Imaginary if exponent is not Rational

class sympy.assumptions.handlers.sets.AskIntegerHandler[source]

Handler for Q.integer Test that an expression belongs to the field of integer numbers

static Add(expr, assumptions)[source]

Integer + Integer -> Integer Integer + !Integer -> !Integer !Integer + !Integer -> ?

static Mul(expr, assumptions)[source]

Integer*Integer -> Integer Integer*Irrational -> !Integer Odd/Even -> !Integer Integer*Rational -> ?

static Pow(expr, assumptions)

Integer + Integer -> Integer Integer + !Integer -> !Integer !Integer + !Integer -> ?

class sympy.assumptions.handlers.sets.AskIrrationalHandler[source]
class sympy.assumptions.handlers.sets.AskRationalHandler[source]

Handler for Q.rational Test that an expression belongs to the field of rational numbers

static Add(expr, assumptions)[source]

Rational + Rational -> Rational Rational + !Rational -> !Rational !Rational + !Rational -> ?

static Mul(expr, assumptions)

Rational + Rational -> Rational Rational + !Rational -> !Rational !Rational + !Rational -> ?

static Pow(expr, assumptions)[source]

Rational ** Integer -> Rational Irrational ** Rational -> Irrational Rational ** Irrational -> ?

class sympy.assumptions.handlers.sets.AskRealHandler[source]

Handler for Q.real Test that an expression belongs to the field of real numbers

static Add(expr, assumptions)[source]

Real + Real -> Real Real + (Complex & !Real) -> !Real

static Mul(expr, assumptions)[source]

Real*Real -> Real Real*Imaginary -> !Real Imaginary*Imaginary -> Real

static Pow(expr, assumptions)[source]

Real**Integer -> Real Positive**Real -> Real Real**(Integer/Even) -> Real if base is nonnegative Real**(Integer/Odd) -> Real Imaginary**(Integer/Even) -> Real Imaginary**(Integer/Odd) -> not Real Imaginary**Real -> ? since Real could be 0 (giving real) or 1 (giving imaginary) b**Imaginary -> Real if log(b) is imaginary and b != 0 and exponent != integer multiple of I*pi/log(b) Real**Real -> ? e.g. sqrt(-1) is imaginary and sqrt(2) is not