ComplexSign

class zixy.container.coeffs.ComplexSign(source: int | ComplexSign | ComplexSign = 0)[source]

Bases: RootOfUnity

A complex sign, i.e. a fourth root of unity (1, i, -1, or -i).

__abs__() → ComplexSign[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.

Raises:

ValueError – If the value of self is not representable as a float.

See also

__int__()

__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: int | ComplexSign | ComplexSign = 0)[source]

Initialize the complex sign.

Parameters:

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

__int__() → int[source]

Convert self to an integer value.

Raises:

ValueError – If the value of self is not representable as an integer.

__mul__(other: int | float | complex | Sign | ComplexSign | Expr) → int | float | complex | Sign | ComplexSign | Expr[source]
Overloads:
  • self, other (float) → complex

  • self, other (complex) → complex

  • self, other (Sign) → ComplexSign

  • self, other (ComplexSign) → ComplexSign

  • self, other (Expr) → Expr

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__() → ComplexSign[source]

Return the negation of self.

__pos__() → Self[source]

Return self.

__repr__() → str

Return a string representation of self.

__rmul__(other: int | float | complex | Sign | ComplexSign | Expr) → int | float | complex | Sign | ComplexSign | Expr[source]
Overloads:
  • self, other (float) → complex

  • self, other (complex) → complex

  • self, other (Sign) → ComplexSign

  • self, other (ComplexSign) → ComplexSign

  • self, other (Expr) → Expr

Out-of-place multiplication of other by self.

See also

__mul__()

__rtruediv__(other: int | float | complex | Sign | ComplexSign | Expr) → int | float | complex | Sign | ComplexSign | Expr[source]
Overloads:
  • self, other (float) → complex

  • self, other (complex) → complex

  • self, other (Sign) → ComplexSign

  • self, other (ComplexSign) → ComplexSign

  • self, other (Expr) → Expr

Out-of-place division of other by self.

__truediv__(other: int | float | complex | Sign | ComplexSign | Expr) → int | float | complex | Sign | ComplexSign | Expr[source]
Overloads:
  • self, other (float) → complex

  • self, other (complex) → complex

  • self, other (Sign) → ComplexSign

  • self, other (ComplexSign) → ComplexSign

  • self, other (Expr) → Expr

Out-of-place division of self by other.

See also

__mul__()

classmethod from_complex(value: complex | float) → Self[source]

Construct an instance of cls from a complex value.

Raises:

ValueError – If value is not exactly representable as cls.

classmethod from_numeric(value: complex | float) → Self

Construct an instance of cls from a complex value.

Raises:

ValueError – If value is not exactly representable as cls.

classmethod from_str(source: str) → Self[source]

Create an instance of cls from a string.

Parameters:

source – String to parse.

Returns:

An instance of cls parsed from source.

Raises:

ValueError – If source is not exactly representable as cls.

classmethod parse(source: str) → Self

Parse a string into an instance of cls.

Deprecated:

use from_str() instead.

Parameters:

source – String to parse.

Returns:

An instance of cls parsed from source.

property phase: int

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

to_numeric() → complex[source]

Convert self to a built-in numeric type.

to_str() → str

Return the canonical string representation of self.

to_symbolic() → Expr[source]

Convert self to a SymPy symbolic constant.