arctans ======= .. py:module:: arctans .. autoapi-nested-parse:: Arctans. Submodules ---------- .. toctree:: :maxdepth: 1 /docs/arctans/arctans/index /docs/arctans/core/index /docs/arctans/generation/index /docs/arctans/numbers/index /docs/arctans/primes/index /docs/arctans/reduction/index Attributes ---------- .. autoapisummary:: arctans.j arctans.one arctans.zero arctans.__version__ Classes ------- .. autoapisummary:: arctans.Integer arctans.Rational arctans.GaussianInteger arctans.GaussianRational Functions --------- .. autoapisummary:: arctans.arccotan arctans.arctan arctans.is_irreducible arctans.reduce arctans.convert_rational arctans.generate Package Contents ---------------- .. py:function:: arccotan(a: arctans.numbers.AbstractNumber | int) -> AbstractTerm Symbolic arccotangent. :param a: The argument of the arccotan :returns: arccotan(a) .. py:function:: arctan(a: arctans.numbers.AbstractNumber | int) -> AbstractTerm Symbolic arctangent. :param a: The argument of the arctan :returns: arctan(a) .. py:class:: Integer(i: int) Bases: :py:obj:`RealNumber` An integer. .. py:attribute:: _i .. py:method:: __str__() .. py:method:: __repr__() .. py:method:: as_latex() -> str Represent in LaTeX. .. py:property:: numerator :type: AbstractNumber Numerator. .. py:property:: denominator :type: Integer Denominator. .. py:method:: __int__() -> int .. py:method:: __float__() -> float .. py:method:: __complex__() -> complex .. py:method:: _to_same_type(other: Any) -> Integer Convert other to the same type as self. .. py:method:: _add(other: Self) -> AbstractNumber Add something of the same type to this. .. py:method:: _sub(other: Self) -> AbstractNumber Subtract something of the same type from this. .. py:method:: _mul(other: Self) -> AbstractNumber Multiply something of the same type by this. .. py:method:: _truediv(other: Self) -> AbstractNumber Divide this by something of the same type. .. py:method:: _pow(other: int) -> AbstractNumber Raise to an integer power. .. py:method:: _mod(other: Self) -> AbstractNumber Find the remainder when dividing this by something of the same type. .. py:method:: _floordiv(other: Self) -> AbstractNumber Find the remainder when dividing this by something of the same type. .. py:method:: _eq(other: Self) -> bool Check if something of the same type is equal to this. .. py:method:: __abs__() .. py:method:: __hash__() .. py:class:: Rational(numerator: int, denominator: int) Bases: :py:obj:`RealNumber` A rational number. .. py:attribute:: _num .. py:attribute:: _den .. py:method:: as_latex() -> str Represent in LaTeX. .. py:method:: __str__() .. py:method:: __repr__() .. py:property:: numerator :type: AbstractNumber Numerator. .. py:property:: denominator :type: Integer Denominator. .. py:method:: __int__() -> int .. py:method:: __float__() -> float .. py:method:: __complex__() -> complex .. py:method:: _to_same_type(other: Any) -> Rational Convert other to the same type as self. .. py:method:: _add(other: Self) -> AbstractNumber Add something of the same type to this. .. py:method:: _sub(other: Self) -> AbstractNumber Subtract something of the same type from this. .. py:method:: _mul(other: Self) -> AbstractNumber Multiply something of the same type by this. .. py:method:: _truediv(other: Self) -> AbstractNumber Divide this by something of the same type. .. py:method:: _pow(other: int) -> AbstractNumber Raise to an integer power. .. py:method:: _eq(other: Self) -> bool Check if something of the same type is equal to this. .. py:method:: __abs__() .. py:class:: GaussianInteger(re: int, im: int) Bases: :py:obj:`AbstractNumber` A Gaussian integer. .. py:attribute:: _re .. py:attribute:: _im .. py:method:: __str__() .. py:method:: __repr__() .. py:property:: real :type: RealNumber Real part. .. py:property:: imag :type: RealNumber Imaginary part. .. py:method:: conjugate() -> AbstractNumber Compute the complex conjugate. .. py:method:: as_latex() -> str Represent in LaTeX. .. py:property:: numerator :type: AbstractNumber Numerator. .. py:property:: denominator :type: Integer Denominator. .. py:method:: __int__() -> int .. py:method:: __float__() -> float .. py:method:: __complex__() -> complex .. py:method:: _to_same_type(other: Any) -> GaussianInteger Convert other to the same type as self. .. py:method:: _add(other: Self) -> AbstractNumber Add something of the same type to this. .. py:method:: _sub(other: Self) -> AbstractNumber Subtract something of the same type from this. .. py:method:: _mul(other: Self) -> AbstractNumber Multiply something of the same type by this. .. py:method:: _truediv(other: Self) -> AbstractNumber Divide this by something of the same type. .. py:method:: _mod(other: Self) -> AbstractNumber Find the remainder when dividing this by something of the same type. .. py:method:: _floordiv(other: Self) -> AbstractNumber Find the remainder when dividing this by something of the same type. .. py:method:: _eq(other: Self) -> bool Check if something of the same type is equal to this. .. py:class:: GaussianRational(re_numerator: int, re_denominator, im_numerator: int, im_denominator: int) Bases: :py:obj:`AbstractNumber` A Gaussian rational. .. py:attribute:: _re_num .. py:attribute:: _re_den .. py:attribute:: _im_num .. py:attribute:: _im_den .. py:method:: __str__() .. py:method:: __repr__() .. py:property:: real :type: RealNumber Real part. .. py:property:: imag :type: RealNumber Imaginary part. .. py:method:: as_latex() -> str Represent in LaTeX. .. py:method:: conjugate() -> AbstractNumber Compute the complex conjugate. .. py:property:: numerator :type: AbstractNumber Numerator. .. py:property:: denominator :type: Integer Denominator. .. py:method:: __int__() -> int .. py:method:: __float__() -> float .. py:method:: __complex__() -> complex .. py:method:: _to_same_type(other: Any) -> GaussianRational Convert other to the same type as self. .. py:method:: _add(other: Self) -> AbstractNumber Add something of the same type to this. .. py:method:: _sub(other: Self) -> AbstractNumber Subtract something of the same type from this. .. py:method:: _mul(other: Self) -> AbstractNumber Multiply something of the same type by this. .. py:method:: _truediv(other: Self) -> AbstractNumber Divide this by something of the same type. .. py:method:: _eq(other: Self) -> bool Check if something of the same type is equal to this. .. py:data:: j .. py:data:: one .. py:data:: zero .. py:function:: 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. :param n: An integer :returns: True if n is irreducible .. py:function:: reduce(a: arctans.arctans.AbstractTerm) -> arctans.arctans.AbstractTerm Express an arctan as a sum of irreducible integral arccotangents. :param a: An arctan or sum of arctans :returns: A sum of irreducible integral arccotangents .. py:function:: convert_rational(a: arctans.arctans.AbstractTerm) -> arctans.arctans.AbstractTerm Convert a rational arccotangent into a sum of integral arccotangents. :param a: An arctan or sum of arctans :returns: A sum of integral arccotangents .. py:function:: 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. :param known_formula: Known formula or formulae that all have the same value :param min_numerator: The minimum numerator to use for arctan arguments :param max_numerator: The maximum numerator to use for arctan arguments :param min_denominator: The minimum denominator to use for arctan arguments :param max_denominator: The maximum denominator to use for arctan arguments :param max_terms: The maximum number of arctan terms to include in the new formulae :param max_coefficient_denominator: The maximum allowbale denominator to use in the coefficients in the new formulae :param printing: Print information about progress :returns: A list of new formulae that have the same value as the known formula(e) .. py:data:: __version__ :value: '1.0.0'