code stringlengths 17 6.64M |
|---|
class RandomVariable_generic(Parent):
'\n A random variable.\n '
def __init__(self, X, RR):
if (not is_ProbabilitySpace(X)):
raise TypeError(('Argument X (= %s) must be a probability space' % X))
Parent.__init__(self, X)
self._codomain = RR
def probability_space... |
class DiscreteRandomVariable(RandomVariable_generic):
'\n A random variable on a discrete probability space.\n '
def __init__(self, X, f, codomain=None, check=False):
'\n Create free binary string monoid on `n` generators.\n\n INPUT:\n\n - X -- a probability space\n ... |
class ProbabilitySpace_generic(RandomVariable_generic):
'\n A probability space.\n '
def __init__(self, domain, RR):
'\n A generic probability space on given domain space and codomain\n ring.\n '
if isinstance(domain, list):
domain = tuple(domain)
... |
class DiscreteProbabilitySpace(ProbabilitySpace_generic, DiscreteRandomVariable):
'\n The discrete probability space\n '
def __init__(self, X, P, codomain=None, check=False):
"\n Create the discrete probability space with probabilities on the\n space X given by the dictionary P wi... |
@total_ordering
class BinaryQF(SageObject):
'\n A binary quadratic form over `\\ZZ`.\n\n INPUT:\n\n One of the following:\n\n - ``a`` -- either a 3-tuple of integers, or a quadratic\n homogeneous polynomial in two variables with integer\n coefficients\n\n - ``a``, ``b``, ``c`` -- three in... |
def BinaryQF_reduced_representatives(D, primitive_only=False, proper=True):
"\n Return representatives for the classes of binary quadratic forms\n of discriminant `D`.\n\n INPUT:\n\n - ``D`` -- (integer) a discriminant\n\n - ``primitive_only`` -- (boolean; default: ``True``): if ``True``, only\n ... |
class BQFClassGroup(Parent, UniqueRepresentation):
'\n This type represents the class group for a given discriminant `D`.\n\n - For `D < 0`, the group is the class group of *positive definite*\n binary quadratic forms. The "full" form class group is the direct\n sum of two isomorphic copies of thi... |
class BQFClassGroup_element(AdditiveGroupElement):
'\n This type represents elements of class groups of binary quadratic forms.\n\n Users should not need to construct objects of this type directly; it can\n be accessed via either the :class:`BQFClassGroup` parent object or the\n :meth:`~BinaryQF.form_... |
def BezoutianQuadraticForm(f, g):
"\n Compute the Bezoutian of two polynomials defined over a common base ring. This is defined by\n\n .. MATH::\n\n {\\rm Bez}(f, g) := \\frac{f(x) g(y) - f(y) g(x)}{y - x}\n\n and has size defined by the maximum of the degrees of `f` and `g`.\n\n INPUT:\n\n ... |
def HyperbolicPlane_quadratic_form(R, r=1):
'\n Constructs the direct sum of `r` copies of the quadratic form `xy`\n representing a hyperbolic plane defined over the base ring `R`.\n\n INPUT:\n\n - ``R``: a ring\n - ``n`` (integer, default 1) number of copies\n\n EXAMPLES::\n\n sage: Hype... |
def is_triangular_number(n, return_value=False):
'\n Return whether ``n`` is a triangular number.\n\n A *triangular number* is a number of the form `k(k+1)/2` for some\n non-negative integer `n`. See :wikipedia:`Triangular_number`. The sequence\n of triangular number is references as A000217 in the On... |
def extend_to_primitive(A_input):
'\n Given a matrix (resp. list of vectors), extend it to a square\n matrix (resp. list of vectors), such that its determinant is the\n gcd of its minors (i.e. extend the basis of a lattice to a\n "maximal" one in `\\ZZ^n`).\n\n Author(s): Gonzalo Tornaria and Jonat... |
def least_quadratic_nonresidue(p):
'\n Return the smallest positive integer quadratic non-residue in `\\ZZ/p\\ZZ` for primes `p>2`.\n\n EXAMPLES::\n\n sage: least_quadratic_nonresidue(5)\n 2\n sage: [least_quadratic_nonresidue(p) for p in prime_range(3, 100)] # needs sage.l... |
def genera(sig_pair, determinant, max_scale=None, even=False):
'\n Return a list of all global genera with the given conditions.\n\n Here a genus is called global if it is non-empty.\n\n INPUT:\n\n - ``sig_pair`` -- a pair of non-negative integers giving the signature\n\n - ``determinant`` -- an in... |
def _local_genera(p, rank, det_val, max_scale, even):
'\n Return all `p`-adic genera with the given conditions.\n\n This is a helper function for :meth:`genera`.\n No input checks are done.\n\n INPUT:\n\n - ``p`` -- a prime number\n\n - ``rank`` -- the rank of this genus\n\n - ``det_val`` -- ... |
def _blocks(b, even_only=False):
'\n Return all viable `2`-adic jordan blocks with rank and scale given by ``b``\n\n This is a helper function for :meth:`_local_genera`.\n It is based on the existence conditions for a modular `2`-adic genus symbol.\n\n INPUT:\n\n - ``b`` -- a list of `5` non-negati... |
def Genus(A, factored_determinant=None):
'\n Given a nonsingular symmetric matrix `A`, return the genus of `A`.\n\n INPUT:\n\n - ``A`` -- a symmetric matrix with integer coefficients\n\n - ``factored_determinant`` -- (default: ``None``) a :class:`Factorization` object,\n the factored determinant ... |
def LocalGenusSymbol(A, p):
'\n Return the local symbol of `A` at the prime `p`.\n\n INPUT:\n\n - ``A`` -- a symmetric, non-singular matrix with coefficients in `\\ZZ`\n - ``p`` -- a prime number\n\n OUTPUT:\n\n A :class:`Genus_Symbol_p_adic_ring` object, encoding the Conway-Sloane\n genus sy... |
def is_GlobalGenus(G):
'\n Return if `G` represents the genus of a global quadratic form or lattice.\n\n INPUT:\n\n - ``G`` -- :class:`GenusSymbol_global_ring` object\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: from sage.quadratic_forms.genera.genus import is_GlobalGenus\n sage: A = ... |
def is_2_adic_genus(genus_symbol_quintuple_list):
"\n Given a `2`-adic local symbol (as the underlying list of quintuples)\n check whether it is the `2`-adic symbol of a `2`-adic form.\n\n INPUT:\n\n - ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain\n restrictions).\n\n ... |
def canonical_2_adic_compartments(genus_symbol_quintuple_list):
'\n Given a `2`-adic local symbol (as the underlying list of quintuples)\n this returns a list of lists of indices of the\n ``genus_symbol_quintuple_list`` which are in the same compartment. A\n compartment is defined to be a maximal int... |
def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None):
'\n Given a `2`-adic local symbol (as the underlying list of quintuples)\n this returns a list of lists of indices of the\n ``genus_symbol_quintuple_list`` which are in the same train. A train\n is defined to be a maximal in... |
def canonical_2_adic_reduction(genus_symbol_quintuple_list):
'\n Given a `2`-adic local symbol (as the underlying list of quintuples)\n this returns a canonical `2`-adic symbol (again as a raw list of\n quintuples of integers) which has at most one minus sign per train\n and this sign appears on the s... |
def basis_complement(B):
'\n Given an echelonized basis matrix `B` (over a field), calculate a\n matrix whose rows form a basis complement (to the rows of `B`).\n\n INPUT:\n\n - ``B`` -- matrix over a field in row echelon form\n\n OUTPUT: a rectangular matrix over a field\n\n EXAMPLES::\n\n ... |
def signature_pair_of_matrix(A):
'\n Computes the signature pair `(p, n)` of a non-degenerate symmetric\n matrix, where\n\n - `p` is the number of positive eigenvalues of `A`\n - `n` is the number of negative eigenvalues of `A`\n\n INPUT:\n\n - ``A`` -- symmetric matrix (assumed to be non-degene... |
def p_adic_symbol(A, p, val):
'\n Given a symmetric matrix `A` and prime `p`, return the genus symbol at `p`.\n\n .. TODO::\n\n Some description of the definition of the genus symbol.\n\n INPUT:\n\n - ``A`` -- symmetric matrix with integer coefficients\n - ``p`` -- prime number\n - ``val`... |
def is_even_matrix(A):
'\n Determines if the integral symmetric matrix `A` is even\n (i.e. represents only even numbers). If not, then it returns the\n index of an odd diagonal entry. If it is even, then we return the\n index `-1`.\n\n INPUT:\n\n - ``A`` -- symmetric integer matrix\n\n OUTP... |
def split_odd(A):
'\n Given a non-degenerate Gram matrix `A (\\mod 8)`, return a splitting\n ``[u] + B`` such that u is odd and `B` is not even.\n\n INPUT:\n\n - ``A`` -- an odd symmetric matrix with integer coefficients (which admits a\n splitting as above).\n\n OUTPUT:\n\n a pair ``(u, B)... |
def trace_diag_mod_8(A):
'\n Return the trace of the diagonalised form of `A` of an integral\n symmetric matrix which is diagonalizable mod `8`. (Note that since\n the Jordan decomposition into blocks of size `\\leq 2` is not unique\n here, this is not the same as saying that `A` is always diagonal i... |
def two_adic_symbol(A, val):
'\n Given a symmetric matrix `A` and prime `p`, return the genus symbol at `p`.\n\n The genus symbol of a component `2^m f` is of the form ``(m,n,s,d[,o])``,\n where\n\n - ``m`` = valuation of the component\n - ``n`` = dimension of `f`\n - ``d`` = det(`f`) in {1,3,5,... |
class Genus_Symbol_p_adic_ring():
'\n Local genus symbol over a `p`-adic ring.\n\n The genus symbol of a component `p^m A` for odd prime `= p` is of the\n form `(m,n,d)`, where\n\n - `m` = valuation of the component\n - `n` = rank of `A`\n - `d = det(A) \\in \\{1,u\\}` for a normalized quadratic... |
class GenusSymbol_global_ring():
'\n This represents a collection of local genus symbols (at primes)\n and signature information which represent the genus of a\n non-degenerate integral lattice.\n\n INPUT:\n\n - ``signature_pair`` -- a tuple of two non-negative integers\n\n - ``local_symbols`` -... |
def _gram_from_jordan_block(p, block, discr_form=False):
'\n Return the Gram matrix of this jordan block.\n\n This is a helper for :meth:`discriminant_form` and :meth:`gram_matrix`.\n No input checks.\n\n INPUT:\n\n - ``p`` -- a prime number\n\n - ``block`` -- a list of 3 integers or 5 integers ... |
def M_p(species, p):
'\n Return the diagonal factor `M_p` as a function of the species.\n\n EXAMPLES:\n\n These examples are taken from Table 2 of [CS1988]_::\n\n sage: from sage.quadratic_forms.genera.genus import M_p\n sage: M_p(0, 2)\n 1\n sage: M_p(1, 2)\n 1/2\n ... |
class SpinorOperator(AbelianGroupElement_gap):
'\n A spinor operator seen as a tuple of square classes.\n\n For `2` the square class is represented as one of `1,3,5,7` and for\n `p` odd it is `1` for a p-adic unit square and `-1` for a non-square.\n\n EXAMPLES::\n\n sage: from sage.quadratic_fo... |
class SpinorOperators(AbelianGroupGap):
'\n The group of spinor operators of a genus.\n\n It is a product of `p`-adic unit square classes\n used for spinor genus computations.\n\n INPUT:\n\n - a tuple of primes `(p_1=2,\\dots, p_n`)\n\n EXAMPLES::\n\n sage: from sage.quadratic_forms.gener... |
def qfsolve(G):
'\n Find a solution `x = (x_0,...,x_n)` to `x G x^t = 0` for an\n `n \\times n`-matrix ``G`` over `\\QQ`.\n\n OUTPUT:\n\n If a solution exists, return a vector of rational numbers `x`.\n Otherwise, returns `-1` if no solution exists over the reals or a\n prime `p` if no solution ... |
def qfparam(G, sol):
'\n Parametrize the conic defined by the matrix `G`.\n\n INPUT:\n\n - ``G`` -- a `3 \\times 3`-matrix over `\\QQ`\n\n - ``sol`` -- a triple of rational numbers providing a solution\n to `x\\cdot G\\cdot x^t = 0`\n\n OUTPUT:\n\n A triple of polynomials that parametrizes ... |
def solve(self, c=0):
"\n Return a vector `x` such that ``self(x) == c``.\n\n INPUT:\n\n - ``c`` -- (default: 0) a rational number\n\n OUTPUT: A non-zero vector `x` satisfying ``self(x) == c``.\n\n ALGORITHM:\n\n Uses PARI's :pari:`qfsolve`. Algorithm described by Jeroen Demeyer; see comments on... |
def is_QuadraticForm(Q):
'\n Determine if the object ``Q`` is an element of the :class:`QuadraticForm` class.\n\n This function is deprecated.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 2, [1,2,3])\n sage: from sage.quadratic_forms.quadratic_form import is_QuadraticForm\n sage: i... |
def quadratic_form_from_invariants(F, rk, det, P, sminus):
"\n Return a rational quadratic form with given invariants.\n\n INPUT:\n\n - ``F`` -- the base field; currently only ``QQ`` is allowed\n - ``rk`` -- integer; the rank\n - ``det`` -- rational; the determinant\n - ``P`` -- a list of primes... |
class QuadraticForm(SageObject):
'\n The ``QuadraticForm`` class represents a quadratic form in `n` variables with\n coefficients in the ring `R`.\n\n INPUT:\n\n The constructor may be called in any of the following ways.\n\n #. ``QuadraticForm(R, n, entries)``, where\n\n - ``R`` -- ring for ... |
def DiagonalQuadraticForm(R, diag):
'\n Return a quadratic form over `R` which is a sum of squares.\n\n INPUT:\n\n - ``R`` -- ring\n - ``diag`` -- list/tuple of elements coercible to `R`\n\n OUTPUT: quadratic form\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7]); Q\n ... |
@cached_method
def basis_of_short_vectors(self, show_lengths=False):
'\n Return a basis for `\\ZZ^n` made of vectors with minimal lengths `Q(v)`.\n\n OUTPUT:\n\n a tuple of vectors, and optionally a tuple of values for each vector.\n\n This uses :pari:`qfminim`.\n\n EXAMPLES::\n\n sage: Q = ... |
def short_vector_list_up_to_length(self, len_bound, up_to_sign_flag=False):
'\n Return a list of lists of short vectors `v`, sorted by length, with\n `Q(v) <` ``len_bound``.\n\n INPUT:\n\n - ``len_bound`` -- bound for the length of the vectors\n\n - ``up_to_sign_flag`` -- (default: ``False``) if se... |
def short_primitive_vector_list_up_to_length(self, len_bound, up_to_sign_flag=False):
'\n Return a list of lists of short primitive vectors `v`, sorted by length, with\n `Q(v) <` ``len_bound``. The list in output `[i]` indexes all vectors of\n length `i`. If the ``up_to_sign_flag`` is set to ``True``, ... |
def _compute_automorphisms(self):
'\n Call PARI to compute the automorphism group of the quadratic form.\n\n This uses :pari:`qfauto`.\n\n OUTPUT: None, this just caches the result.\n\n TESTS::\n\n sage: DiagonalQuadraticForm(ZZ, [-1,1,1])._compute_automorphisms()\n Traceback (most recen... |
def automorphism_group(self):
'\n Return the group of automorphisms of the quadratic form.\n\n OUTPUT: a :class:`MatrixGroup`\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n sage: Q.automorphism_group()\n Matrix group over Rational Field with 3 generators (\n ... |
def automorphisms(self):
'\n Return the list of the automorphisms of the quadratic form.\n\n OUTPUT: a list of matrices\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n sage: Q.number_of_automorphisms()\n 48\n sage: 2^3 * factorial(3)\n 48\n sage... |
def number_of_automorphisms(self):
'\n Return the number of automorphisms (of det `1` and `-1`) of\n the quadratic form.\n\n OUTPUT: an integer `\\geq 2`.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 3, [1, 0, 0, 1, 0, 1], unsafe_initialization=True)\n sage: Q.number_of_automorphisms()... |
def set_number_of_automorphisms(self, num_autos):
"\n Set the number of automorphisms to be the value given. No error\n checking is performed, to this may lead to erroneous results.\n\n The fact that this result was set externally is recorded in the\n internal list of external initializations, access... |
def count_congruence_solutions_as_vector(self, p, k, m, zvec, nzvec):
'\n Return the number of integer solution vectors `x` satisfying the\n congruence `Q(x) = m` (mod `p^k`) of each solution type (i.e. All,\n Good, Zero, Bad, BadI, BadII) which satisfy the additional\n congruence conditions of having... |
def count_congruence_solutions(self, p, k, m, zvec, nzvec):
'\n Count all solutions of `Q(x) = m` (mod `p^k`) satisfying the\n additional congruence conditions described in\n :meth:`QuadraticForm.count_congruence_solutions_as_vector`.\n\n INPUT:\n\n - ``p`` -- prime number > 0\n\n - ``k`` -- an ... |
def count_congruence_solutions__good_type(self, p, k, m, zvec, nzvec):
'\n Count the good-type solutions of `Q(x) = m` (mod `p^k`) satisfying the\n additional congruence conditions described in\n :meth:`QuadraticForm.count_congruence_solutions_as_vector`.\n\n INPUT:\n\n - ``p`` -- prime number > 0\... |
def count_congruence_solutions__zero_type(self, p, k, m, zvec, nzvec):
'\n Count the zero-type solutions of `Q(x) = m` (mod `p^k`) satisfying the\n additional congruence conditions described in\n :meth:`QuadraticForm.count_congruence_solutions_as_vector`.\n\n INPUT:\n\n - ``p`` -- prime number > 0\... |
def count_congruence_solutions__bad_type(self, p, k, m, zvec, nzvec):
'\n Count the bad-type solutions of `Q(x) = m` (mod `p^k`) satisfying the\n additional congruence conditions described in\n :meth:`QuadraticForm.count_congruence_solutions_as_vector`.\n\n INPUT:\n\n - ``p`` -- prime number > 0\n\... |
def count_congruence_solutions__bad_type_I(self, p, k, m, zvec, nzvec):
'\n Count the bad-typeI solutions of `Q(x) = m` (mod `p^k`) satisfying\n the additional congruence conditions described in\n :meth:`QuadraticForm.count_congruence_solutions_as_vector`.\n\n INPUT:\n\n - ``p`` -- prime number > 0... |
def count_congruence_solutions__bad_type_II(self, p, k, m, zvec, nzvec):
'\n Count the bad-typeII solutions of `Q(x) = m` (mod `p^k`) satisfying\n the additional congruence conditions described in\n :meth:`QuadraticForm.count_congruence_solutions_as_vector`.\n\n INPUT:\n\n - ``p`` -- prime number >... |
def is_globally_equivalent_to(self, other, return_matrix=False):
'\n Determine if the current quadratic form is equivalent to the\n given form over `\\ZZ`.\n\n If ``return_matrix`` is True, then we return the transformation\n matrix `M` so that ``self(M) == other``.\n\n INPUT:\n\n - ``self``, ``... |
def is_locally_equivalent_to(self, other, check_primes_only=False, force_jordan_equivalence_test=False):
'\n Determine if the current quadratic form (defined over `\\ZZ`) is\n locally equivalent to the given form over the real numbers and the\n `p`-adic integers for every prime `p`.\n\n This works by ... |
def has_equivalent_Jordan_decomposition_at_prime(self, other, p):
'\n Determine if the given quadratic form has a Jordan decomposition\n equivalent to that of ``self``.\n\n INPUT:\n\n - ``other`` -- a :class:`QuadraticForm`\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q1 = QuadraticForm(Z... |
def is_rationally_isometric(self, other, return_matrix=False):
"\n Determine if two regular quadratic forms over a number field are isometric.\n\n INPUT:\n\n - ``other`` -- a quadratic form over a number field\n\n - ``return_matrix`` -- (boolean, default ``False``) return\n the transformation mat... |
def _diagonal_isometry(V, W):
'\n Given two diagonal, rationally equivalent quadratic forms, computes a\n transition matrix mapping from one to the other.\n\n .. NOTE::\n\n This function is an auxiliary method of ``isometry``, which is\n the method that should be called as it performs error... |
def _gram_schmidt(m, fixed_vector_index, inner_product):
'\n Orthogonalize a set of vectors, starting at a fixed vector, with respect to a given\n inner product.\n\n INPUT:\n\n - ``m`` -- a square matrix whose columns represent vectors\n - ``fixed_vector_index`` -- any vectors preceding the vector ... |
def global_genus_symbol(self):
'\n Return the genus of two times a quadratic form over `\\ZZ`.\n\n These are defined by a collection of local genus symbols (a la\n Chapter 15 of Conway-Sloane [CS1999]_), and a signature.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,2,3,4])\n ... |
def local_genus_symbol(self, p):
"\n Return the Conway-Sloane genus symbol of 2 times a quadratic form\n defined over `\\ZZ` at a prime number `p`.\n\n This is defined (in the class\n :class:`~sage.quadratic_forms.genera.genus.Genus_Symbol_p_adic_ring`)\n to be a list of tuples (one for each Jordan... |
def CS_genus_symbol_list(self, force_recomputation=False):
'\n Return the list of Conway-Sloane genus symbols in increasing order of primes dividing 2*det.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,2,3,4])\n sage: Q.CS_genus_symbol_list()\n [Genus symbol at 2: [2^-2 4... |
def count_modp_solutions__by_Gauss_sum(self, p, m):
'\n Return the number of solutions of `Q(x) = m` (mod `p`) of a\n non-degenerate quadratic form over the finite field `\\ZZ/p\\ZZ`,\n where `p` is a prime number > 2.\n\n .. NOTE::\n\n We adopt the useful convention that a zero-dimensional\n ... |
def local_good_density_congruence_odd(self, p, m, Zvec, NZvec):
'\n Find the Good-type local density of `Q` representing `m` at `p`.\n (Assuming that `p > 2` and `Q` is given in local diagonal form.)\n\n The additional congruence condition arguments ``Zvec`` and ``NZvec`` can\n be either a list of ind... |
def local_good_density_congruence_even(self, m, Zvec, NZvec):
'\n Find the Good-type local density of `Q` representing `m` at `p=2`.\n (Assuming `Q` is given in local diagonal form.)\n\n The additional congruence condition arguments ``Zvec`` and ``NZvec`` can\n be either a list of indices or None. ``... |
def local_good_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the Good-type local density of `Q` representing `m` at `p`.\n (Front end routine for parity specific routines for `p`.)\n\n .. TODO::\n\n Add documentation about the additional congruence\n conditions ``Zvec`` an... |
def local_zero_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the Zero-type local density of `Q` representing `m` at `p`,\n allowing certain congruence conditions mod `p`.\n\n INPUT:\n\n - ``self`` -- quadratic form `Q`, assumed to be block diagonal and `p`-integral\n\n - ``p`` -- ... |
def local_badI_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the Bad-type I local density of `Q` representing `m` at `p`.\n (Assuming that `p > 2` and `Q` is given in local diagonal form.)\n\n INPUT:\n\n - ``self`` -- quadratic form `Q`, assumed to be block diagonal and `p`-integral\... |
def local_badII_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the Bad-type II local density of `Q` representing `m` at `p`.\n (Assuming that `p > 2` and `Q` is given in local diagonal form.)\n\n INPUT:\n\n - ``self`` -- quadratic form `Q`, assumed to be block diagonal and `p`-integra... |
def local_bad_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the Bad-type local density of `Q` representing\n `m` at `p`, allowing certain congruence conditions mod `p`.\n\n INPUT:\n\n - ``self`` -- quadratic form `Q`, assumed to be block diagonal and `p`-integral\n\n - ``p`` -- a ... |
def local_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the local density of `Q` representing `m` at `p`,\n allowing certain congruence conditions mod `p`.\n\n INPUT:\n\n - ``self`` -- quadratic form `Q`, assumed to be block diagonal and `p`-integral\n\n - ``p`` -- a prime number\... |
def local_primitive_density_congruence(self, p, m, Zvec=None, NZvec=None):
'\n Find the primitive local density of `Q` representing\n `m` at `p`, allowing certain congruence conditions mod `p`.\n\n .. NOTE::\n\n The following routine is not used internally, but is included for consistency.\n\n ... |
def local_density(self, p, m):
'\n Return the local density.\n\n .. NOTE::\n\n This screens for imprimitive forms, and puts the quadratic\n form in local normal form, which is a *requirement* of the\n routines performing the computations!\n\n INPUT:\n\n - ``p`` -- a prime number >... |
def local_primitive_density(self, p, m):
'\n Return the local primitive density -- should be called by the user. =)\n\n NOTE: This screens for imprimitive forms, and puts the\n quadratic form in local normal form, which is a *requirement* of\n the routines performing the computations!\n\n INPUT:\n\... |
def rational_diagonal_form(self, return_matrix=False):
'\n Return a diagonal form equivalent to the given quadratic from\n over the fraction field of its defining ring.\n\n INPUT:\n\n - ``return_matrix`` -- (boolean, default: False) also return the\n transformation matrix\n\n OUTPUT: either th... |
@cached_method
def _rational_diagonal_form_and_transformation(self):
'\n Return a diagonal form equivalent to the given quadratic from and\n the corresponding transformation matrix. This is over the fraction\n field of the base ring of the given quadratic form.\n\n OUTPUT: a tuple `(D,T)` where\n\n ... |
def signature_vector(self):
'\n Return the triple `(p, n, z)` of integers where\n\n - `p` = number of positive eigenvalues\n - `n` = number of negative eigenvalues\n - `z` = number of zero eigenvalues\n\n for the symmetric matrix associated to `Q`.\n\n OUTPUT: a triple of integers `\\geq 0`\n\n ... |
def signature(self):
'\n Return the signature of the quadratic form, defined as:\n\n number of positive eigenvalues `-` number of negative eigenvalues\n\n of the matrix of the quadratic form.\n\n OUTPUT: an integer\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,0,0,-4,3,11,3])\... |
def hasse_invariant(self, p):
"\n Compute the Hasse invariant at a prime `p` or at infinity, as given on p55 of\n Cassels's book. If `Q` is diagonal with coefficients `a_i`, then the\n (Cassels) Hasse invariant is given by\n\n .. MATH::\n\n c_p = \\prod_{i < j} (a_i, a_j)_p\n\n where `(a,b)... |
def hasse_invariant__OMeara(self, p):
"\n Compute the O'Meara Hasse invariant at a prime `p`.\n\n This is defined on\n p167 of O'Meara's book. If `Q` is diagonal with coefficients `a_i`,\n then the (Cassels) Hasse invariant is given by\n\n .. MATH::\n\n c_p = \\prod_{i \\leq j} (a_i, a_j)_p\... |
def is_hyperbolic(self, p):
'\n Check if the quadratic form is a sum of hyperbolic planes over\n the `p`-adic numbers `\\QQ_p` or over the real numbers `\\RR`.\n\n REFERENCES:\n\n This criterion follows from Cassels\'s "Rational Quadratic Forms":\n\n - local invariants for hyperbolic plane (Lemma 2... |
def is_anisotropic(self, p):
'\n Check if the quadratic form is anisotropic over the `p`-adic numbers `\\QQ_p` or `\\RR`.\n\n INPUT:\n\n - ``p`` -- a prime number > 0 or `-1` for the infinite place\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1])\n sag... |
def is_isotropic(self, p):
'\n Checks if `Q` is isotropic over the `p`-adic numbers `\\QQ_p` or `\\RR`.\n\n INPUT:\n\n - ``p`` -- a prime number > 0 or `-1` for the infinite place\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1])\n sage: Q.is_isotropic(... |
def anisotropic_primes(self):
'\n Return a list with all of the anisotropic primes of the quadratic form.\n\n The infinite place is denoted by `-1`.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n sage: Q.anisotropic_primes() ... |
def compute_definiteness(self):
'\n Compute whether the given quadratic form is positive-definite,\n negative-definite, indefinite, degenerate, or the zero form.\n\n This caches one of the following strings in ``self.__definiteness_string``:\n "pos_def", "neg_def", "indef", "zero", "degenerate". It i... |
def compute_definiteness_string_by_determinants(self):
"\n Compute the (positive) definiteness of a quadratic form by looking\n at the signs of all of its upper-left subdeterminants. See also\n :meth:`compute_definiteness` for more documentation.\n\n OUTPUT: string describing the definiteness\n\n ... |
def is_positive_definite(self):
'\n Determines if the given quadratic form is positive-definite.\n\n .. NOTE::\n\n A degenerate form is considered neither definite nor indefinite.\n\n .. NOTE::\n\n The zero-dimensional form is considered both positive definite and negative definite.\n\n ... |
def is_negative_definite(self):
'\n Determines if the given quadratic form is negative-definite.\n\n .. NOTE::\n\n A degenerate form is considered neither definite nor indefinite.\n\n .. NOTE::\n\n The zero-dimensional form is considered both positive definite and negative definite.\n\n ... |
def is_indefinite(self):
'\n Determines if the given quadratic form is indefinite.\n\n .. NOTE::\n\n A degenerate form is considered neither definite nor indefinite.\n\n .. NOTE::\n\n The zero-dimensional form is not considered indefinite.\n\n OUTPUT: boolean -- True or False\n\n EXAM... |
def is_definite(self):
'\n Determines if the given quadratic form is (positive or negative) definite.\n\n .. NOTE::\n\n A degenerate form is considered neither definite nor indefinite.\n\n .. NOTE::\n\n The zero-dimensional form is considered indefinite.\n\n OUTPUT: boolean -- True or Fa... |
def find_entry_with_minimal_scale_at_prime(self, p):
'\n Find the entry of the quadratic form with minimal scale at the\n prime `p`, preferring diagonal entries in case of a tie.\n\n (I.e. If\n we write the quadratic form as a symmetric matrix `M`, then this\n entry ``M[i,j]`` has the minimal valu... |
def local_normal_form(self, p):
'\n Return a locally integrally equivalent quadratic form over\n the `p`-adic integers `\\ZZ_p` which gives the Jordan decomposition.\n\n The Jordan components are written as sums of blocks of size `\\leq 2`\n and are arranged by increasing scale, and then by increasing... |
def jordan_blocks_by_scale_and_unimodular(self, p, safe_flag=True):
'\n Return a list of pairs `(s_i, L_i)` where `L_i` is a maximal\n `p^{s_i}`-unimodular Jordan component which is further decomposed into\n block diagonals of block size `\\le 2`.\n\n For each `L_i` the `2 \\times 2` blocks are listed... |
def jordan_blocks_in_unimodular_list_by_scale_power(self, p):
'\n Return a list of Jordan components, whose component at index `i`\n should be scaled by the factor `p^i`.\n\n This is only defined for integer-valued quadratic forms\n (i.e., forms with base ring `\\ZZ`), and the indexing only works\n ... |
class QuadraticFormLocalRepresentationConditions():
'\n A class for dealing with the local conditions of a\n quadratic form, and checking local representability of numbers.\n\n EXAMPLES::\n\n sage: Q4 = DiagonalQuadraticForm(ZZ, [1,1,1,1])\n sage: Q4.local_representation_conditions()\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.