arctans¶
Arctans.
Submodules¶
Attributes¶
Classes¶
An integer. |
|
A rational number. |
|
A Gaussian integer. |
|
A Gaussian rational. |
Functions¶
|
Symbolic arccotangent. |
|
Symbolic arctangent. |
|
Check if arctan(n) is irreducible. |
|
Express an arctan as a sum of irreducible integral arccotangents. |
|
Convert a rational arccotangent into a sum of integral arccotangents. |
|
Generate new formulae. |
Package Contents¶
- arctans.arccotan(a: arctans.numbers.AbstractNumber | int) AbstractTerm¶
Symbolic arccotangent.
- Parameters:
a – The argument of the arccotan
- Returns:
arccotan(a)
- arctans.arctan(a: arctans.numbers.AbstractNumber | int) AbstractTerm¶
Symbolic arctangent.
- Parameters:
a – The argument of the arctan
- Returns:
arctan(a)
- class arctans.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.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.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.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.j¶
- arctans.one¶
- arctans.zero¶
- arctans.is_irreducible(n: arctans.numbers.Integer | int) bool¶
Check if arctan(n) is irreducible.
An arctan is irreducible iff it cannot be written as a weighted sum of integer arccotangents, or equivalently arctan(n) is irreducible iff the largest prime factor of 1 + n**2 is greater than or equal to 2*n.
- Parameters:
n – An integer
- Returns:
True if n is irreducible
- arctans.reduce(a: arctans.arctans.AbstractTerm) arctans.arctans.AbstractTerm¶
Express an arctan as a sum of irreducible integral arccotangents.
- Parameters:
a – An arctan or sum of arctans
- Returns:
A sum of irreducible integral arccotangents
- arctans.convert_rational(a: arctans.arctans.AbstractTerm) arctans.arctans.AbstractTerm¶
Convert a rational arccotangent into a sum of integral arccotangents.
- Parameters:
a – An arctan or sum of arctans
- Returns:
A sum of integral arccotangents
- arctans.generate(known_formula: arctans.arctans.AbstractTerm | Sequence[arctans.arctans.AbstractTerm], *, min_denominator: int = 1, max_denominator: int = 100, min_numerator: int = 1, max_numerator: int = 1, max_terms: int | None = None, max_coefficient_denominator: int | None = None, printing: bool = False) list[arctans.arctans.AbstractTerm]¶
Generate new formulae.
- Parameters:
known_formula – Known formula or formulae that all have the same value
min_numerator – The minimum numerator to use for arctan arguments
max_numerator – The maximum numerator to use for arctan arguments
min_denominator – The minimum denominator to use for arctan arguments
max_denominator – The maximum denominator to use for arctan arguments
max_terms – The maximum number of arctan terms to include in the new formulae
max_coefficient_denominator – The maximum allowbale denominator to use in the coefficients in the new formulae
printing – Print information about progress
- Returns:
A list of new formulae that have the same value as the known formula(e)
- arctans.__version__ = '1.0.0'¶