code
stringlengths
17
6.64M
class InfinityRing_class(Singleton, Ring): def __init__(self): '\n Initialize ``self``.\n\n TESTS::\n\n sage: sage.rings.infinity.InfinityRing_class() is sage.rings.infinity.InfinityRing_class() is InfinityRing\n True\n\n Comparison tests::\n\n sage: ...
class FiniteNumber(RingElement): def __init__(self, parent, x): '\n Initialize ``self``.\n\n TESTS::\n\n sage: sage.rings.infinity.FiniteNumber(InfinityRing, 1)\n A positive finite number\n sage: sage.rings.infinity.FiniteNumber(InfinityRing, -1)\n ...
class MinusInfinity(_uniq, AnInfinity, InfinityElement): _sign = (- 1) _sign_char = '-' def __init__(self): '\n Initialize ``self``.\n\n TESTS::\n\n sage: sage.rings.infinity.MinusInfinity() is sage.rings.infinity.MinusInfinity() is -oo\n True\n ' ...
class PlusInfinity(_uniq, AnInfinity, InfinityElement): _sign = 1 _sign_char = '+' def __init__(self): '\n Initialize ``self``.\n\n TESTS::\n\n sage: sage.rings.infinity.PlusInfinity() is sage.rings.infinity.PlusInfinity() is oo\n True\n ' Infini...
def test_comparison(ring): "\n Check comparison with infinity\n\n INPUT:\n\n - ``ring`` -- a sub-ring of the real numbers\n\n OUTPUT:\n\n Various attempts are made to generate elements of ``ring``. An\n assertion is triggered if one of these elements does not compare\n correctly with plus/min...
def test_signed_infinity(pos_inf): "\n Test consistency of infinity representations.\n\n There are different possible representations of infinity in\n Sage. These are all consistent with the infinity ring, that is,\n compare with infinity in the expected way. See also :trac:`14045`\n\n INPUT:\n\n ...
def _guess_variables(polynomial, *args): '\n Return the polynomial variables.\n\n INPUT:\n\n - ``polynomial`` -- a polynomial, or a list/tuple of polynomials\n in the same polynomial ring.\n\n - ``*args`` -- the variables. If none are specified, all variables\n in ``polynomial`` are returned...
def transvectant(f, g, h=1, scale='default'): "\n Return the h-th transvectant of f and g.\n\n INPUT:\n\n - ``f``, ``g`` -- two homogeneous binary forms in the same polynomial ring.\n\n - ``h`` -- the order of the transvectant. If it is not specified,\n the first transvectant is returned.\n\n ...
@richcmp_method class FormsBase(SageObject): '\n The common base class of :class:`AlgebraicForm` and\n :class:`SeveralAlgebraicForms`.\n\n This is an abstract base class to provide common methods. It does\n not make much sense to instantiate it.\n\n TESTS::\n\n sage: from sage.rings.invarian...
class AlgebraicForm(FormsBase): '\n The base class of algebraic forms (i.e. homogeneous polynomials).\n\n You should only instantiate the derived classes of this base\n class.\n\n Derived classes must implement ``coeffs()`` and\n ``scaled_coeffs()``\n\n INPUT:\n\n - ``n`` -- The number of var...
class QuadraticForm(AlgebraicForm): "\n Invariant theory of a multivariate quadratic form.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See :meth:`~InvariantTheoryFactory.quadratic_form`\n for details.\n\n TEST...
class BinaryQuartic(AlgebraicForm): "\n Invariant theory of a binary quartic.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See :meth:`~InvariantTheoryFactory.binary_quartic`\n for details.\n\n TESTS::\n\n ...
class BinaryQuintic(AlgebraicForm): "\n Invariant theory of a binary quintic form.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See :meth:`~InvariantTheoryFactory.binary_quintic`\n for details.\n\n REFERENCES:\...
def _covariant_conic(A_scaled_coeffs, B_scaled_coeffs, monomials): '\n Helper function for :meth:`TernaryQuadratic.covariant_conic`\n\n INPUT:\n\n - ``A_scaled_coeffs``, ``B_scaled_coeffs`` -- The scaled\n coefficients of the two ternary quadratics.\n\n - ``monomials`` -- The monomials :meth:`~Te...
class TernaryQuadratic(QuadraticForm): '\n Invariant theory of a ternary quadratic.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See\n :meth:`~InvariantTheoryFactory.ternary_quadratic` for details.\n\n TESTS::\...
class TernaryCubic(AlgebraicForm): '\n Invariant theory of a ternary cubic.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See :meth:`~InvariantTheoryFactory.ternary_cubic`\n for details.\n\n TESTS::\n\n s...
class SeveralAlgebraicForms(FormsBase): '\n The base class of multiple algebraic forms (i.e. homogeneous polynomials).\n\n You should only instantiate the derived classes of this base\n class.\n\n See :class:`AlgebraicForm` for the base class of a single\n algebraic form.\n\n INPUT:\n\n - ``f...
class TwoAlgebraicForms(SeveralAlgebraicForms): def first(self): '\n Return the first of the two forms.\n\n OUTPUT:\n\n The first algebraic form used in the definition.\n\n EXAMPLES::\n\n sage: R.<x,y> = QQ[]\n sage: q0 = invariant_theory.quadratic_form(x...
class TwoTernaryQuadratics(TwoAlgebraicForms): '\n Invariant theory of two ternary quadratics.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See\n :meth:`~InvariantTheoryFactory.ternary_biquadratics` for\n detai...
class TwoQuaternaryQuadratics(TwoAlgebraicForms): '\n Invariant theory of two quaternary quadratics.\n\n You should use the :class:`invariant_theory\n <InvariantTheoryFactory>` factory object to construct instances\n of this class. See\n :meth:`~InvariantTheoryFactory.quaternary_biquadratics` for\n...
class InvariantTheoryFactory(): '\n Factory object for invariants of multilinear forms.\n\n Use the invariant_theory object to construct algebraic forms. These\n can then be queried for invariant and covariants.\n\n EXAMPLES::\n\n sage: R.<x,y,z> = QQ[]\n sage: invariant_theory.ternary_c...
def binary_quadratic_coefficients_from_invariants(discriminant, invariant_choice='default'): "\n Reconstruct a binary quadratic from the value of its discriminant.\n\n INPUT:\n\n - ``discriminant`` -- The value of the discriminant of the\n binary quadratic.\n\n - ``invariant_choice`` -- The type ...
def binary_cubic_coefficients_from_invariants(discriminant, invariant_choice='default'): "\n Reconstruct a binary cubic from the value of its discriminant.\n\n INPUT:\n\n - ``discriminant`` -- The value of the discriminant of the\n binary cubic.\n\n - ``invariant_choice`` -- The type of invariant...
def binary_quintic_coefficients_from_invariants(invariants, K=None, invariant_choice='default', scaling='none'): "\n Reconstruct a binary quintic from the values of its (Clebsch) invariants.\n\n INPUT:\n\n - ``invariants`` -- A list or tuple of values of the three or four\n invariants. The default o...
def _reduce_invariants(invariants, weights): '\n Reduce a list of invariants of given weights.\n\n Reduces the given invariants over a field whose rings of integers is a gcd\n domain, in such a way that their greatest common weighted divisor is a unit\n in this ring.\n\n INPUT:\n\n - ``invariant...
def is_LaurentSeriesRing(x): '\n Return ``True`` if this is a *univariate* Laurent series ring.\n\n This is in keeping with the behavior of ``is_PolynomialRing``\n versus ``is_MPolynomialRing``.\n\n TESTS::\n\n sage: from sage.rings.laurent_series_ring import is_LaurentSeriesRing\n sage:...
class LaurentSeriesRing(UniqueRepresentation, CommutativeRing): '\n Univariate Laurent Series Ring.\n\n EXAMPLES::\n\n sage: R = LaurentSeriesRing(QQ, \'x\'); R\n Laurent Series Ring in x over Rational Field\n sage: x = R.0\n sage: g = 1 - x + x^2 - x^4 + O(x^8); g\n 1 - x...
class LazyModuleElement(Element): '\n A lazy sequence with a module structure given by term-wise\n addition and scalar multiplication.\n\n EXAMPLES::\n\n sage: L.<z> = LazyLaurentSeriesRing(ZZ)\n sage: M = L(lambda n: n, valuation=0)\n sage: N = L(lambda n: 1, valuation=0)\n s...
class LazyCauchyProductSeries(LazyModuleElement): '\n A class for series where multiplication is the Cauchy product.\n\n EXAMPLES::\n\n sage: L.<z> = LazyLaurentSeriesRing(ZZ)\n sage: f = 1 / (1 - z)\n sage: f\n 1 + z + z^2 + O(z^3)\n sage: f * (1 - z)\n 1\n\n ...
class LazyLaurentSeries(LazyCauchyProductSeries): '\n A Laurent series where the coefficients are computed lazily.\n\n EXAMPLES::\n\n sage: L.<z> = LazyLaurentSeriesRing(ZZ)\n\n We can build a series from a function and specify if the series\n eventually takes a constant value::\n\n sage...
class LazyPowerSeries(LazyCauchyProductSeries): '\n A Taylor series where the coefficients are computed lazily.\n\n EXAMPLES::\n\n sage: L.<x, y> = LazyPowerSeriesRing(ZZ)\n sage: f = 1 / (1 - x^2 + y^3); f\n 1 + x^2 + (-y^3) + x^4 + (-2*x^2*y^3) + (x^6+y^6) + O(x,y)^7\n sage: P....
class LazyPowerSeries_gcd_mixin(): '\n A lazy power series that also implements the GCD algorithm.\n ' def gcd(self, other): '\n Return the greatest common divisor of ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: L.<x> = LazyPowerSeriesRing(QQ)\n sage: a =...
class LazyCompletionGradedAlgebraElement(LazyCauchyProductSeries): '\n An element of a completion of a graded algebra that is computed lazily.\n ' def _format_series(self, formatter, format_strings=False): "\n Return nonzero ``self`` formatted by ``formatter``.\n\n TESTS::\n\n ...
class LazySymmetricFunction(LazyCompletionGradedAlgebraElement): '\n A symmetric function where each degree is computed lazily.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules\n sage: L = LazySymmetricFunctions(s) ...
class LazyDirichletSeries(LazyModuleElement): '\n A Dirichlet series where the coefficients are computed lazily.\n\n EXAMPLES::\n\n sage: L = LazyDirichletSeriesRing(ZZ, "z")\n sage: f = L(constant=1)^2\n sage: f # ...
class LazySeriesRing(UniqueRepresentation, Parent): '\n Abstract base class for lazy series.\n ' @staticmethod def __classcall_private__(cls, base_ring, names, sparse=True, *args, **kwds): "\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sag...
class LazyLaurentSeriesRing(LazySeriesRing): '\n The ring of lazy Laurent series.\n\n The ring of Laurent series over a ring with the usual arithmetic\n where the coefficients are computed lazily.\n\n INPUT:\n\n - ``base_ring`` -- base ring\n - ``names`` -- name of the generator\n - ``sparse`...
class LazyPowerSeriesRing(LazySeriesRing): "\n The ring of (possibly multivariate) lazy Taylor series.\n\n INPUT:\n\n - ``base_ring`` -- base ring of this Taylor series ring\n - ``names`` -- name(s) of the generator of this Taylor series ring\n - ``sparse`` -- (default: ``True``) whether this serie...
class LazyCompletionGradedAlgebra(LazySeriesRing): '\n The completion of a graded algebra consisting of formal series.\n\n For a graded algebra `A`, we can form a completion of `A` consisting of\n all formal series of `A` such that each homogeneous component is\n a finite linear combination of basis e...
class LazySymmetricFunctions(LazyCompletionGradedAlgebra): '\n The ring of lazy symmetric functions.\n\n INPUT:\n\n - ``basis`` -- the ring of symmetric functions\n - ``names`` -- name(s) of the alphabets\n - ``sparse`` -- (default: ``True``) whether we use a sparse or a dense representation\n\n ...
class LazyDirichletSeriesRing(LazySeriesRing): "\n The ring of lazy Dirichlet series.\n\n INPUT:\n\n - ``base_ring`` -- base ring of this Dirichlet series ring\n - ``names`` -- name of the generator of this Dirichlet series ring\n - ``sparse`` -- (default: ``True``) whether this series is sparse or...
def _skip_leading_zeros(iterator): '\n Return an iterator which discards all leading zeros.\n\n EXAMPLES::\n\n sage: from sage.rings.lazy_series_ring import _skip_leading_zeros\n sage: it = map(lambda x: 0 if x < 10 else x, NN)\n sage: [x for x, _ in zip(_skip_leading_zeros(it), range(1...
def normalize_extra_units(base_ring, add_units, warning=True): '\n Function to normalize input data.\n\n The given list will be replaced by a list of the involved prime factors\n (if possible).\n\n INPUT:\n\n - ``base_ring`` -- an instance of :class:`IntegralDomain`\n - ``add_units`` -- list of ...
class LocalizationElement(IntegralDomainElement): "\n Element class for localizations of integral domains\n\n INPUT:\n\n - ``parent`` -- instance of :class:`Localization`\n - ``x`` -- instance of :class:`FractionFieldElement` whose parent is the fraction\n field of the parent's base ring\n\n ...
class Localization(IntegralDomain, UniqueRepresentation): '\n The localization generalizes the construction of the field of fractions of an integral domain to\n an arbitrary ring. Given a (not necessarily commutative) ring `R` and a subset `S` of `R`,\n there exists a ring `R[S^{-1}]` together with the r...
def _monomials(gens, R, n, i): '\n Given two lists ``gens`` and ``n`` of exactly the same length,\n return all monomials in the elements of ``gens`` in ``R`` where\n the ``i``-th generator in the monomial appears to degree strictly\n less than ``n[i]``.\n\n EXAMPLES::\n\n sage: monomials([x]...
def monomials(v, n): '\n Given two lists ``v`` and ``n``, of exactly the same length,\n return all monomials in the elements of ``v``, where\n variable ``i`` (i.e., ``v[i]``) in the monomial appears to\n degree strictly less than ``n[i]``.\n\n INPUT:\n\n - ``v`` -- list of ring elements\n\n -...
def is_MPowerSeriesRing(x): "\n Return ``True`` if input is a multivariate power series ring.\n\n TESTS::\n\n sage: from sage.rings.power_series_ring import is_PowerSeriesRing\n sage: from sage.rings.multi_power_series_ring import is_MPowerSeriesRing\n sage: M = PowerSeriesRing(ZZ, 4, '...
class MPowerSeriesRing_generic(PowerSeriesRing_generic, Nonexact): '\n A multivariate power series ring. This class is implemented as a\n single variable power series ring in the variable ``T`` over a\n multivariable polynomial ring in the specified generators. Each\n generator ``g`` of the multivar...
def unpickle_multi_power_series_ring_v0(base_ring, num_gens, names, order, default_prec, sparse): '\n Unpickle (deserialize) a multivariate power series ring according\n to the given inputs.\n\n EXAMPLES::\n\n sage: P.<x,y> = PowerSeriesRing(QQ)\n sage: loads(dumps(P)) == P # indirect docte...
def is_MPowerSeries(f): "\n Return ``True`` if ``f`` is a multivariate power series.\n\n TESTS::\n\n sage: from sage.rings.power_series_ring_element import is_PowerSeries\n sage: from sage.rings.multi_power_series_ring_element import is_MPowerSeries\n sage: M = PowerSeriesRing(ZZ,4,'v')...
class MPowerSeries(PowerSeries): "\n Multivariate power series; these are the elements of Multivariate Power\n Series Rings.\n\n INPUT:\n\n - ``parent`` -- A multivariate power series.\n\n - ``x`` -- The element (default: 0). This can be another\n :class:`MPowerSeries` object, or an element o...
class MO(): '\n Object representing a zero element with given precision.\n\n EXAMPLES::\n\n sage: R.<u,v> = QQ[[]]\n sage: m = O(u, v)\n sage: m^4\n 0 + O(u, v)^4\n sage: m^1\n 0 + O(u, v)^1\n\n sage: T.<a,b,c> = PowerSeriesRing(ZZ, 3)\n sage: z = O(a,...
def column_Log(SUK, iota, U, prec=106): "\n Return the log vector of ``iota``; i.e., the logs of all the valuations.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``iota`` -- an element of ``K``\n - ``U`` -- a list of places (finite or infinite) of ``K``\n - ``prec`` -- the precision of t...
def c3_func(SUK, prec=106): "\n Return the constant `c_3` from [AKMRVW]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``prec`` -- the precision of the real field (default: 106)\n\n OUTPUT:\n\n The constant `c_3`, as a real number\n\n EXAMPLES::\n\n sage: from sage.rings.number...
def c4_func(SUK, v, A, prec=106): "\n Return the constant `c_4` from Smart's TCDF paper, [Sma1995]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- a place of ``K``, finite (a fractional ideal) or infinite (element of ``SUK.number_field().places(prec)``)\n - ``A`` -- the set of the p...
def beta_k(betas_and_ns): "\n Return a pair `[\\beta_k,|beta_k|_v]`, where `\\beta_k` has the smallest nonzero valuation in absolute value of the list ``betas_and_ns``.\n\n INPUT:\n\n - ``betas_and_ns`` -- a list of pairs ``[beta,val_v(beta)]`` outputted from the function where ``beta`` is an element of ...
def mus(SUK, v): "\n Return a list `[\\mu]`, for `\\mu` defined in [AKMRVW]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- a finite place of ``K``\n\n OUTPUT:\n\n A list ``[mus]`` where each ``mu`` is an element of ``K``\n\n EXAMPLES::\n\n sage: from sage.rings.number_...
def possible_mu0s(SUK, v): "\n Return a list `[\\mu_0]` of all possible `\\mu_0` values defined in [AKMRVW]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- a finite place of ``K``\n\n OUTPUT:\n\n A list ``[mu0s]`` where each ``mu0`` is an element of ``K``\n\n EXAMPLES::\n\n ...
def Yu_a1_kappa1_c1(p, dK, ep): '\n Compute the constants a(1), kappa1, and c(1) of [Yu2007]_.\n\n INPUT:\n\n - ``p`` -- a rational prime number\n - ``dK`` -- the absolute degree of some number field `K`\n - ``ep`` -- the absolute ramification index of some prime ``frak_p`` of `K` lying above `p`\n...
def Yu_condition_115(K, v): "\n Return ``True`` or ``False``, as the number field ``K`` and the finite place ``v`` satisfy condition (1.15) of [Yu2007]_.\n\n INPUT:\n\n - ``K`` -- a number field\n - ``v`` -- a finite place of ``K``\n\n OUTPUT:\n\n ``True`` if (1.15) is satisfied, otherwise ``Fal...
def Yu_modified_height(mu, n, v, prec=106): "\n Return the value of h(n)(mu) as appearing in [Yu2007]_ equation (1.21).\n\n INPUT:\n\n - ``mu`` -- an element of a field K\n - ``n`` -- number of mu_j to be considered in Yu's Theorem.\n - ``v`` -- a place of K\n - ``prec`` -- the precision of the ...
def Omega_prime(dK, v, mu_list, prec=106): "\n Return the constant `\\Omega'` appearing in [AKMRVW]_.\n\n INPUT:\n\n - ``dK`` -- the degree of a number field `K`\n - ``v`` -- a finite place of `K`\n - ``mu_list`` -- a list of nonzero elements of `K`. It is assumed that the sublist ``mu_list[1:]`` i...
def Yu_C1_star(n, v, prec=106): "\n Return the constant `C_1^*` appearing in [Yu2007]_ (1.23).\n\n INPUT:\n\n - ``n`` -- the number of generators of a multiplicative subgroup of a field `K`\n - ``v`` -- a finite place of `K` (a fractional ideal)\n - ``prec`` -- the precision of the real field\n\n ...
def Yu_bound(SUK, v, prec=106): "\n Return `c_8` such that `c_8 \\geq exp(2)/\\log(2)` and `ord_p (\\Theta - 1) < c_8 \\log B`,\n where `\\Theta = \\prod_{j=1}^n \\alpha_j^{b_j}` and `B \\geq \\max_j |b_j|` and `B \\geq 3`.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- a finite plac...
def K0_func(SUK, A, prec=106): "\n Return the constant `K_0` from [AKMRVW]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``A`` -- the set of the products of the coefficients of the `S`-unit equation with each root of unity of `K`\n - ``prec`` -- the precision of the real field (default: 10...
def c11_func(SUK, v, A, prec=106): "\n Return the constant `c_{11}` from Smart's TCDF paper, [Sma1995]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- a place of `K`, finite (a fractional ideal) or infinite (element of ``SUK.number_field().places(prec)``)\n - ``A`` -- the set of the...
def c13_func(SUK, v, prec=106): "\n Return the constant `c_{13}` from Smart's TCDF paper, [Sma1995]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- an infinite place of ``K`` (element of ``SUK.number_field().places(prec)``)\n - ``prec`` -- the precision of the real field (default: 1...
def K1_func(SUK, v, A, prec=106): "\n Return the constant `K_1` from Smart's TCDF paper, [Sma1995]_.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``v`` -- an infinite place of `K` (element of ``SUK.number_field().places(prec)``)\n - ``A`` -- a list of all products of each potential `a`, `b`...
def minimal_vector(A, y, prec=106): '\n INPUT:\n\n - ``A`` -- a square `n` by `n` non-singular integer matrix whose rows generate a lattice `\\mathcal L`\n - ``y`` -- a row (1 by `n`) vector with integer coordinates\n - ``prec`` -- precision of real field (default: 106)\n\n OUTPUT:\n\n A lower b...
def reduction_step_complex_case(place, B0, list_of_gens, torsion_gen, c13): "\n INPUT:\n\n - ``place`` -- (ring morphism) an infinite place of a number field `K`\n - ``B0`` -- the initial bound\n - ``list_of_gens`` -- a set of generators of the free part of the group\n - ``torsion_gen`` -- an eleme...
def cx_LLL_bound(SUK, A, prec=106): "\n Return the maximum of all of the `K_1`'s as they are LLL-optimized for each infinite place `v`.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``A`` -- a list of all products of each potential `a`, `b` in the `S`-unit equation `ax + by + 1 = 0` with each r...
def log_p(a, prime, prec): "\n INPUT:\n\n - ``a`` -- an element of a number field `K`\n - ``prime`` -- a prime ideal of the number field `K`\n - ``prec`` -- a positive integer\n\n OUTPUT:\n\n An element of `K` which is congruent to the ``prime``-adic logarithm of `a` with respect to ``prime`` mo...
def log_p_series_part(a, prime, prec): "\n INPUT:\n\n - ``a`` -- an element of a number field `K`\n - ``prime`` -- a prime ideal of the number field `K`\n - ``prec`` -- a positive integer\n\n OUTPUT:\n\n The ``prime``-adic logarithm of `a` and accuracy ``p^prec``, where `p` is the rational prime...
def defining_polynomial_for_Kp(prime, prec=106): '\n INPUT:\n\n - ``prime`` -- a prime ideal of a number field `K`\n - ``prec`` -- a positive natural number (default: 106)\n\n OUTPUT:\n\n A polynomial with integer coefficients that is equivalent ``mod p^prec`` to a defining polynomial for the compl...
def embedding_to_Kp(a, prime, prec): "\n INPUT:\n\n - ``a`` -- an element of a number field `K`\n - ``prime`` -- a prime ideal of `K`\n - ``prec`` -- a positive natural number\n\n OUTPUT:\n\n An element of `K` that is equivalent to `a` modulo ``p^(prec)`` and the generator of `K` appears with ex...
def p_adic_LLL_bound_one_prime(prime, B0, M, M_logp, m0, c3, prec=106): "\n INPUT:\n\n - ``prime`` -- a prime ideal of a number field `K`\n - ``B0`` -- the initial bound\n - ``M`` -- a list of elements of `K`, the `\\mu_i`'s from Lemma IX.3 of [Sma1998]_\n - ``M_logp`` -- the p-adic logarithm of el...
def p_adic_LLL_bound(SUK, A, prec=106): "\n Return the maximum of all of the `K_0`'s as they are LLL-optimized for each finite place `v`.\n\n INPUT:\n\n - ``SUK`` -- a group of `S`-units\n - ``A`` -- a list of all products of each potential `a`, `b` in the `S`-unit equation `ax + by + 1 = 0` with each...
def split_primes_large_lcm(SUK, bound): "\n Return a list `L` of rational primes `q` which split completely in `K` and which have desirable properties (see NOTE).\n\n INPUT:\n\n - ``SUK`` -- the `S`-unit group of an absolute number field `K`.\n - ``bound`` -- a positive integer\n\n OUTPUT:\n\n A...
def sieve_ordering(SUK, q): "\n Return ordered data for running sieve on the primes in ``SUK`` over the rational prime `q`.\n\n INPUT:\n\n - ``SUK`` -- the `S`-unit group of a number field `K`\n - ``q`` -- a rational prime number which splits completely in `K`\n\n OUTPUT:\n\n A list of tuples,...
def clean_rfv_dict(rfv_dictionary): '\n Given a residue field vector dictionary, remove some impossible keys and entries.\n\n INPUT:\n\n - ``rfv_dictionary`` -- a dictionary whose keys are exponent vectors and whose values are residue field vectors\n\n OUTPUT:\n\n ``None``. But it removes some keys...
def construct_rfv_to_ev(rfv_dictionary, q, d, verbose=False): '\n Return a reverse lookup dictionary, to find the exponent vectors associated to a given residue field vector.\n\n INPUT:\n\n - ``rfv_dictionary`` -- a dictionary whose keys are exponent vectors and whose values are the associated residue fi...
def construct_comp_exp_vec(rfv_to_ev_dict, q): '\n Constructs a dictionary associating complement vectors to residue field vectors.\n\n INPUT:\n\n - ``rfv_to_ev_dict`` -- a dictionary whose keys are residue field vectors and whose values are lists of exponent vectors with the associated residue field vec...
def drop_vector(ev, p, q, complement_ev_dict): '\n Determine if the exponent vector, ``ev``, may be removed from the complement dictionary during construction.\n This will occur if ``ev`` is not compatible with an exponent vector mod `q-1`.\n\n INPUT:\n\n - ``ev`` -- an exponent vector modulo `p-1`\n ...
def construct_complement_dictionaries(split_primes_list, SUK, verbose=False): "\n Construct the complement exponent vector dictionaries.\n\n INPUT:\n\n - ``split_primes_list`` -- a list of rational primes which split completely in the number field `K`\n - ``SUK`` -- the `S`-unit group for a number fie...
def compatible_vectors_check(a0, a1, g, l): '\n Given exponent vectors with respect to two moduli, determine if they are compatible.\n\n INPUT:\n\n - ``a0`` -- an exponent vector modulo ``m0``\n - ``a1`` -- an exponent vector modulo ``m1`` (must have the same length as ``a0``)\n - ``g`` -- the gcd ...
def compatible_vectors(a, m0, m1, g): '\n Given an exponent vector ``a`` modulo ``m0``, return an iterator over the exponent vectors for the modulus ``m1``, such that a lift to the lcm modulus exists.\n\n INPUT:\n\n - ``a`` -- an exponent vector for the modulus ``m0``\n - ``m0`` -- a positive integer...
def compatible_systems(split_prime_list, complement_exp_vec_dict): '\n Given dictionaries of complement exponent vectors for various primes that split in `K`, compute all possible compatible systems.\n\n INPUT:\n\n - ``split_prime_list`` -- a list of rational primes that split completely in `K`\n - ``...
def compatible_system_lift(compatible_system, split_primes_list): '\n Given a compatible system of exponent vectors and complementary exponent vectors, return a lift to the integers.\n\n INPUT:\n\n - ``compatible_system`` -- a list of pairs ``[ [v0, w0], [v1, w1], .., [vk, wk] ]``\n where [vi, wi] i...
def solutions_from_systems(SUK, bound, cs_list, split_primes_list): "\n Lift compatible systems to the integers and return the `S`-unit equation solutions that the lifts yield.\n\n INPUT:\n\n - ``SUK`` -- the group of `S`-units where we search for solutions\n - ``bound`` -- a bound for the entries of ...
def clean_sfs(sfs_list): '\n Given a list of `S`-unit equation solutions, remove trivial redundancies.\n\n INPUT:\n\n - ``sfs_list`` -- a list of solutions to the `S`-unit equation\n\n OUTPUT:\n\n A list of solutions to the `S`-unit equation\n\n .. NOTE::\n\n The function looks for cases ...
def sieve_below_bound(K, S, bound=10, bump=10, split_primes_list=[], verbose=False): "\n Return all solutions to the `S`-unit equation `x + y = 1` over `K` with exponents below the given bound.\n\n INPUT:\n\n - ``K`` -- a number field (an absolute extension of the rationals)\n - ``S`` -- a list of fin...
def solve_S_unit_equation(K, S, prec=106, include_exponents=True, include_bound=False, proof=None, verbose=False): "\n Return all solutions to the `S`-unit equation `x + y = 1` over `K`.\n\n INPUT:\n\n - ``K`` -- a number field (an absolute extension of the rationals)\n - ``S`` -- a list of finite pri...
def eq_up_to_order(A, B): '\n If ``A`` and ``B`` are lists of four-tuples ``[a0,a1,a2,a3]`` and ``[b0,b1,b2,b3]``,\n check that there is some reordering so that either ``ai=bi`` for all ``i`` or\n ``a0==b1``, ``a1==b0``, ``a2==b3``, ``a3==b2``.\n\n The entries must be hashable.\n\n EXAMPLES::\n\n ...
def bdd_norm_pr_gens_iq(K, norm_list): "\n Compute generators for all principal ideals in an imaginary quadratic field\n `K` whose norms are in ``norm_list``.\n\n The only keys for the output dictionary are integers n appearing in\n ``norm_list``.\n\n The function will only be called with `K` an im...
def bdd_height_iq(K, height_bound): "\n Compute all elements in the imaginary quadratic field `K` which have\n relative multiplicative height at most ``height_bound``.\n\n The function will only be called with `K` an imaginary quadratic field.\n\n If called with `K` not an imaginary quadratic, the fun...
def bdd_norm_pr_ideal_gens(K, norm_list): "\n Compute generators for all principal ideals in a number field `K` whose\n norms are in ``norm_list``.\n\n INPUT:\n\n - `K` -- a number field\n\n - ``norm_list`` -- a list of positive integers\n\n OUTPUT:\n\n - a dictionary of number field elements...
def integer_points_in_polytope(matrix, interval_radius): '\n Return the set of integer points in the polytope obtained by acting on a\n cube by a linear transformation.\n\n Given an `r`-by-`r` matrix ``matrix`` and a real number ``interval_radius``,\n this function finds all integer lattice points in ...
def bdd_height(K, height_bound, tolerance=0.01, precision=53): "\n Compute all elements in the number field `K` which have relative\n multiplicative height at most ``height_bound``.\n\n The function can only be called for number fields `K` with positive unit\n rank. An error will occur if `K` is `\\QQ...
class FractionalIdealClass(AbelianGroupWithValuesElement): "\n A fractional ideal class in a number field.\n\n EXAMPLES::\n\n sage: x = polygen(ZZ, 'x')\n sage: G = NumberField(x^2 + 23,'a').class_group(); G\n Class group of order 3 with structure C3 of\n Number Field in a with ...