Sign

class zixy.container.coeffs.Sign(source: bool | int | Sign | Sign = False)[source]

Bases: RootOfUnity

A real sign, i.e. a square root of unity (either +1 or -1).

__abs__() Sign[source]

Return the absolute value of self.

__complex__() complex[source]

Convert self to a complex floating point value.

__eq__(other: object) bool[source]

Return whether self and other are equal.

__float__() float[source]

Convert self to a floating point value.

__imul__(rhs: int | float | complex | Sign | ComplexSign | Expr) Self[source]

Multiply self by rhs.

Raises:

ValueError – If the result of the multiplication cannot be represented by the type of self.

__init__(source: bool | int | Sign | Sign = False)[source]

Initialize the sign.

Parameters:

source – Either a boolean or integer interpreted as the exponent \(k\) such that the value of the sign is \((-1)^k\), a Rust-bound Sign instance, or an existing Sign instance.

__int__() int[source]

Convert self to an integer value.

__mul__(other: OtherCoeffT) OtherCoeffT[source]

Out-of-place multiplication of self by other.

Note

The return type is determined by the type of the right-hand operand other, with appropriate type promotion rules.

__neg__() Sign[source]

Return the negation of self.

__pos__() Self[source]

Return self.

__repr__() str

Return a string representation of self.

__rmul__(other: OtherCoeffT) OtherCoeffT[source]

Out-of-place multiplication of other by self.

See also

__mul__()

__rtruediv__(other: OtherCoeffT) OtherCoeffT[source]
Overloads:
  • self, other (float) → float

  • self, other (complex) → complex

  • self, other (Sign) → Sign

  • self, other (ComplexSign) → ComplexSign

  • self, other (Expr) → Expr

Out-of-place division of other by self.

__truediv__(other: OtherCoeffT) OtherCoeffT[source]
Overloads:
  • self, other (float) → float

  • self, other (complex) → complex

  • self, other (Sign) → Sign

  • self, other (ComplexSign) → ComplexSign

  • self, other (Expr) → Expr

Out-of-place division of self by other.

See also

__mul__()

classmethod from_int(value: int | float | complex) Sign[source]

Construct an instance of cls from an integer.

Raises:

ValueError – If value is not exactly representable as cls.

classmethod from_numeric(value: int | float | complex) Sign

Construct an instance of cls from an integer.

Raises:

ValueError – If value is not exactly representable as cls.

property phase: bool

Get the phase \(k\) satisfying the value of the sign as \((-1)^k\).

to_numeric() int[source]

Convert self to a built-in numeric type.

to_symbolic() Expr[source]

Convert self to a SymPy symbolic constant.