arctans.numbers¶
Numbers.
Attributes¶
Classes¶
Base class for number. |
|
A real number. |
|
An integer. |
|
A rational number. |
|
A Gaussian integer. |
|
A Gaussian rational. |
Functions¶
|
Convert i to a simpler type if possible. |
|
Convert a and b to the same type. |
Module Contents¶
- class arctans.numbers.AbstractNumber¶
Bases:
arctans.core.RepresentableBase class for number.
- property real: RealNumber¶
- Abstractmethod:
Real part.
- property imag: RealNumber¶
- Abstractmethod:
Imaginary part.
- property numerator: AbstractNumber¶
- Abstractmethod:
Numerator.
- abstractmethod conjugate() AbstractNumber¶
Compute the complex conjugate.
- abstractmethod __int__() int¶
- abstractmethod __float__() float¶
- abstractmethod __complex__() complex¶
- abstractmethod _to_same_type(other: Any) Self¶
Convert other to the same type as self.
- abstractmethod _add(other: Self) AbstractNumber¶
Add something of the same type to this.
- abstractmethod _sub(other: Self) AbstractNumber¶
Subtract something of the same type from this.
- abstractmethod _mul(other: Self) AbstractNumber¶
Multiply something of the same type by this.
- abstractmethod _truediv(other: Self) AbstractNumber¶
Divide this by something of the same type.
- _mod(other: Self) AbstractNumber¶
Find the remainder when dividing this by something of the same type.
- _floordiv(other: Self) AbstractNumber¶
Find the remainder when dividing this by something of the same type.
- abstractmethod _eq(other: Self) bool¶
Check if something of the same type is equal to this.
- _pow(other: int) AbstractNumber¶
Raise to an integer power.
- __add__(other: Any)¶
- __radd__(other: Any)¶
- __sub__(other: Any)¶
- __rsub__(other: Any)¶
- __mul__(other: Any)¶
- __rmul__(other: Any)¶
- __neg__()¶
- __truediv__(other: Any)¶
- __rtruediv__(other: Any)¶
- __mod__(other: Any)¶
- __rmod__(other: Any)¶
- __floordiv__(other: Any)¶
- __rfloordiv__(other: Any)¶
- __eq__(other) bool¶
- __pow__(other)¶
- __rpow__(other)¶
- __iadd__(other)¶
- __isub__(other)¶
- __imul__(other)¶
- __abs__()¶
- __hash__()¶
- class arctans.numbers.RealNumber¶
Bases:
AbstractNumberA real number.
- property real: RealNumber¶
Real part.
- property imag: RealNumber¶
Imaginary part.
- conjugate() AbstractNumber¶
Compute the complex conjugate.
- __lt__(other) bool¶
- __le__(other) bool¶
- __gt__(other) bool¶
- __ge__(other) bool¶
- class arctans.numbers.Integer(i: int)¶
Bases:
RealNumberAn integer.
- _i¶
- __str__()¶
- __repr__()¶
- as_latex() str¶
Represent in LaTeX.
- property numerator: AbstractNumber¶
Numerator.
- __int__() int¶
- __float__() float¶
- __complex__() complex¶
- _add(other: Self) AbstractNumber¶
Add something of the same type to this.
- _sub(other: Self) AbstractNumber¶
Subtract something of the same type from this.
- _mul(other: Self) AbstractNumber¶
Multiply something of the same type by this.
- _truediv(other: Self) AbstractNumber¶
Divide this by something of the same type.
- _pow(other: int) AbstractNumber¶
Raise to an integer power.
- _mod(other: Self) AbstractNumber¶
Find the remainder when dividing this by something of the same type.
- _floordiv(other: Self) AbstractNumber¶
Find the remainder when dividing this by something of the same type.
- _eq(other: Self) bool¶
Check if something of the same type is equal to this.
- __abs__()¶
- __hash__()¶
- class arctans.numbers.Rational(numerator: int, denominator: int)¶
Bases:
RealNumberA rational number.
- _num¶
- _den¶
- as_latex() str¶
Represent in LaTeX.
- __str__()¶
- __repr__()¶
- property numerator: AbstractNumber¶
Numerator.
- __int__() int¶
- __float__() float¶
- __complex__() complex¶
- _add(other: Self) AbstractNumber¶
Add something of the same type to this.
- _sub(other: Self) AbstractNumber¶
Subtract something of the same type from this.
- _mul(other: Self) AbstractNumber¶
Multiply something of the same type by this.
- _truediv(other: Self) AbstractNumber¶
Divide this by something of the same type.
- _pow(other: int) AbstractNumber¶
Raise to an integer power.
- _eq(other: Self) bool¶
Check if something of the same type is equal to this.
- __abs__()¶
- class arctans.numbers.GaussianInteger(re: int, im: int)¶
Bases:
AbstractNumberA Gaussian integer.
- _re¶
- _im¶
- __str__()¶
- __repr__()¶
- property real: RealNumber¶
Real part.
- property imag: RealNumber¶
Imaginary part.
- conjugate() AbstractNumber¶
Compute the complex conjugate.
- as_latex() str¶
Represent in LaTeX.
- property numerator: AbstractNumber¶
Numerator.
- __int__() int¶
- __float__() float¶
- __complex__() complex¶
- _to_same_type(other: Any) GaussianInteger¶
Convert other to the same type as self.
- _add(other: Self) AbstractNumber¶
Add something of the same type to this.
- _sub(other: Self) AbstractNumber¶
Subtract something of the same type from this.
- _mul(other: Self) AbstractNumber¶
Multiply something of the same type by this.
- _truediv(other: Self) AbstractNumber¶
Divide this by something of the same type.
- _mod(other: Self) AbstractNumber¶
Find the remainder when dividing this by something of the same type.
- _floordiv(other: Self) AbstractNumber¶
Find the remainder when dividing this by something of the same type.
- _eq(other: Self) bool¶
Check if something of the same type is equal to this.
- class arctans.numbers.GaussianRational(re_numerator: int, re_denominator, im_numerator: int, im_denominator: int)¶
Bases:
AbstractNumberA Gaussian rational.
- _re_num¶
- _re_den¶
- _im_num¶
- _im_den¶
- __str__()¶
- __repr__()¶
- property real: RealNumber¶
Real part.
- property imag: RealNumber¶
Imaginary part.
- as_latex() str¶
Represent in LaTeX.
- conjugate() AbstractNumber¶
Compute the complex conjugate.
- property numerator: AbstractNumber¶
Numerator.
- __int__() int¶
- __float__() float¶
- __complex__() complex¶
- _to_same_type(other: Any) GaussianRational¶
Convert other to the same type as self.
- _add(other: Self) AbstractNumber¶
Add something of the same type to this.
- _sub(other: Self) AbstractNumber¶
Subtract something of the same type from this.
- _mul(other: Self) AbstractNumber¶
Multiply something of the same type by this.
- _truediv(other: Self) AbstractNumber¶
Divide this by something of the same type.
- _eq(other: Self) bool¶
Check if something of the same type is equal to this.
- arctans.numbers._simplify_type(i: AbstractNumber) AbstractNumber¶
Convert i to a simpler type if possible.
- arctans.numbers._as_common_type(a: AbstractNumber, b: Any) tuple[AbstractNumber, AbstractNumber]¶
Convert a and b to the same type.
- arctans.numbers.j¶
- arctans.numbers.zero¶
- arctans.numbers.one¶