code
stringlengths
17
6.64M
def local_representation_conditions(self, recompute_flag=False, silent_flag=False): '\n .. WARNING::\n\n This only works correctly for forms in >=3 variables,\n which are locally universal at almost all primes!\n\n This class finds the local conditions for a number to be integrally\n repres...
def is_locally_universal_at_prime(self, p) -> bool: '\n Determine if the (integer-valued/rational) quadratic form represents all of `\\ZZ_p`.\n\n INPUT:\n\n - ``p`` -- a positive prime number or "infinity"\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7])\...
def is_locally_universal_at_all_primes(self) -> bool: '\n Determine if the quadratic form represents `\\ZZ_p` for all finite/non-archimedean primes.\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7])\n sage: Q.is_locally_universal_at_all_primes()\n ...
def is_locally_universal_at_all_places(self) -> bool: '\n Determine if the quadratic form represents `\\ZZ_p` for all\n finite/non-archimedean primes, and represents all real numbers.\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7])\n sage: Q.is_local...
def is_locally_represented_number_at_place(self, m, p) -> bool: "\n Determine if the rational number `m` is locally represented by the\n quadratic form at the (possibly infinite) prime `p`.\n\n INPUT:\n\n - ``m`` -- an integer\n\n - ``p`` -- a prime number > 0 or 'infinity'\n\n OUTPUT: boolean\n...
def is_locally_represented_number(self, m) -> bool: '\n Determine if the rational number `m` is locally represented\n by the quadratic form.\n\n INPUT:\n\n - ``m`` -- an integer\n\n OUTPUT: boolean\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n sage: Q.is_locally...
def shimura_mass__maximal(self): "\n Use Shimura's exact mass formula to compute the mass of a maximal\n quadratic lattice. This works for any totally real number field,\n but has a small technical restriction when `n` is odd.\n\n OUTPUT:\n\n a rational number\n\n EXAMPLES::\n\n sage: Q =...
def GHY_mass__maximal(self): '\n Use the GHY formula to compute the mass of a (maximal?) quadratic\n lattice. This works for any number field.\n\n REFERENCES:\n\n See [GHY, Prop 7.4 and 7.5, p121] and [GY, Thrm 10.20, p25].\n\n OUTPUT:\n\n a rational number\n\n EXAMPLES::\n\n sage: Q =...
def parity(self, allow_rescaling_flag=True): '\n Return the parity ("even" or "odd") of an integer-valued quadratic\n form over `\\ZZ`, defined up to similitude/rescaling of the form so that\n its Jordan component of smallest scale is unimodular. After this\n rescaling, we say a form is even if it on...
def is_even(self, allow_rescaling_flag=True) -> bool: '\n Return true iff after rescaling by some appropriate factor, the\n form represents no odd integers. For more details, see :meth:`parity`.\n\n Requires that `Q` is defined over `\\ZZ`.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 2, [1,...
def is_odd(self, allow_rescaling_flag=True): '\n Return true iff after rescaling by some appropriate factor, the\n form represents some odd integers. For more details, see :meth:`parity`.\n\n Requires that `Q` is defined over `\\ZZ`.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 2, [1, 0, 1])...
def conway_species_list_at_odd_prime(self, p): "\n Return an integer called the 'species' which determines the type\n of the orthogonal group over the finite field `\\GF{p}`.\n\n This assumes that the given quadratic form is a unimodular Jordan\n block at an odd prime `p`. When the dimension is odd t...
def conway_species_list_at_2(self): "\n Return an integer called the 'species' which determines the type\n of the orthogonal group over the finite field `\\GF{p}`.\n\n This assumes that the given quadratic form is a unimodular Jordan\n block at an odd prime `p`. When the dimension is odd then this\n ...
def conway_octane_of_this_unimodular_Jordan_block_at_2(self): "\n Determines the 'octane' of this full unimodular Jordan block at\n the prime `p=2`. This is an invariant defined (mod 8), ad.\n\n This assumes that the form is given as a block diagonal form with\n unimodular blocks of size `\\leq 2` an...
def conway_diagonal_factor(self, p): "\n Compute the diagonal factor of Conway's `p`-mass.\n\n INPUT:\n\n - ``p`` -- a prime number > 0\n\n OUTPUT: a rational number > 0\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, range(1,6))\n sage: Q.conway_diagonal_factor(3)\n 81/...
def conway_cross_product_doubled_power(self, p): "\n Compute twice the power of `p` which evaluates the 'cross product'\n term in Conway's mass formula.\n\n INPUT:\n\n - ``p`` -- a prime number > 0\n\n OUTPUT: a rational number\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, range(...
def conway_type_factor(self): '\n This is a special factor only present in the mass formula when `p=2`.\n\n OUTPUT: a rational number\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, range(1,8))\n sage: Q.conway_type_factor()\n 4\n ' jordan_list = self.jordan_blocks_in_u...
def conway_p_mass(self, p): "\n Compute Conway's `p`-mass.\n\n INPUT:\n\n - ``p`` -- a prime number > 0\n\n OUTPUT: a rational number > 0\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, range(1, 6))\n sage: Q.conway_p_mass(2)\n 16/3\n sage: Q.conway_p_mass(3)\n ...
def conway_standard_p_mass(self, p): '\n Compute the standard (generic) Conway-Sloane `p`-mass.\n\n INPUT:\n\n - ``p`` -- a prime number > 0\n\n OUTPUT: a rational number > 0\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n sage: Q.conway_standard_p_mass(2)\n 2...
def conway_standard_mass(self): '\n Return the infinite product of the standard mass factors.\n\n OUTPUT: a rational number > 0\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 3, [2, -2, 0, 3, -5, 4])\n sage: Q.conway_standard_mass() # needs s...
def conway_mass(self): '\n Compute the mass by using the Conway-Sloane mass formula.\n\n OUTPUT: a rational number > 0\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n sage: Q.conway_mass() # needs sage.symbolic\n ...
def mass__by_Siegel_densities(self, odd_algorithm='Pall', even_algorithm='Watson'): '\n Return the mass of transformations (det 1 and -1).\n\n .. WARNING::\n\n This is broken right now...\n\n INPUT:\n\n - ``odd_algorithm`` -- algorithm to be used when `p>2`; ``"Pall"`` (only one choice for now)...
def Pall_mass_density_at_odd_prime(self, p): '\n Return the local representation density of a form (for\n representing itself) defined over `\\ZZ`, at some prime `p>2`.\n\n REFERENCES:\n\n Pall\'s article "The Weight of a Genus of Positive n-ary Quadratic Forms"\n appearing in Proc. Symp. Pure Math...
def Watson_mass_at_2(self): '\n Return the local mass of the quadratic form when `p=2`, according\n to Watson\'s Theorem 1 of "The 2-adic density of a quadratic form"\n in Mathematika 23 (1976), pp 94--106.\n\n OUTPUT: a rational number\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, ...
def Kitaoka_mass_at_2(self): '\n Return the local mass of the quadratic form when `p=2`, according\n to Theorem 5.6.3 on pp108--9 of Kitaoka\'s Book "The Arithmetic of\n Quadratic Forms".\n\n OUTPUT: a rational number > 0\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])\n ...
def mass_at_two_by_counting_mod_power(self, k): "\n Compute the local mass at `p=2` assuming that it's stable (mod `2^k`).\n\n .. NOTE::\n\n This is **way** too slow to be useful, even when `k=1`.\n\n .. TODO::\n\n Remove this routine, or try to compile it!\n\n INPUT:\n\n - ``k`` -- a...
def reduced_binary_form1(self): '\n Reduce the form `ax^2 + bxy+cy^2` to satisfy the reduced condition `|b| \\le\n a \\le c`, with `b \\ge 0` if `a = c`. This reduction occurs within the\n proper class, so all transformations are taken to have determinant 1.\n\n EXAMPLES::\n\n sage: QuadraticFo...
def reduced_ternary_form__Dickson(self): '\n Find the unique reduced ternary form according to the conditions\n of Dickson\'s "Studies in the Theory of Numbers", pp164-171.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1, 1, 1])\n sage: Q.reduced_ternary_form__Dickson()\n T...
def reduced_binary_form(self): '\n Find a form which is reduced in the sense that no further binary\n form reductions can be done to reduce the original form.\n\n EXAMPLES::\n\n sage: QuadraticForm(ZZ, 2, [5,5,2]).reduced_binary_form() # needs sage.symbolic\n (\n ...
def minkowski_reduction(self): '\n Find a Minkowski-reduced form equivalent to the given one.\n\n This means that\n\n .. MATH::\n\n Q(v_k) \\leq Q(s_1\\cdot v_1 + ... + s_n\\cdot v_n)\n\n for all `s_i` where `\\gcd(s_k, ... s_n) = 1`.\n\n .. NOTE::\n\n When `Q` has dim `\\leq 4` w...
def minkowski_reduction_for_4vars__SP(self): '\n Find a Minkowski-reduced form equivalent to the given one.\n This means that\n\n .. MATH::\n\n Q(v_k) \\leq Q(s_1\\cdot v_1 + ... + s_n\\cdot v_n)\n\n for all `s_i` where GCD(`s_k, ... s_n`) = 1.\n\n .. NOTE::\n\n When `Q` has dim `\\le...
def siegel_product(self, u): "\n Compute the infinite product of local densities of the quadratic\n form for the number `u`.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1])\n sage: Q.theta_series(11)\n 1 + 8*q + 24*q^2 + 32*q^3 + 24*q^4 + 48*q^5 + 96*q^6 + 64*q^7 + ...
def cholesky_decomposition(self, bit_prec=53): '\n Give the Cholesky decomposition of this quadratic form `Q` as a real matrix\n of precision ``bit_prec``.\n\n RESTRICTIONS:\n\n `Q` must be given as a :class:`QuadraticForm` defined over `\\ZZ`, `\\QQ`, or some\n real field. If it is over so...
def vectors_by_length(self, bound): '\n Return a list of short vectors together with their values.\n\n This is a naive algorithm which uses the Cholesky decomposition,\n but does not use the LLL-reduction algorithm.\n\n INPUT:\n\n - ``bound`` -- an integer `\\geq 0`\n\n OUTPUT:\n\n - a list `...
def complementary_subform_to_vector(self, v): '\n Find the `(n-1)`-dimensional quadratic form orthogonal to the vector `v`.\n\n .. NOTE::\n\n This is usually not a direct summand!\n\n .. NOTE::\n\n There is a minor difference in the cancellation\n code here (form the C++ version) sin...
def split_local_cover(self): '\n Tries to find subform of the given (positive definite quaternary)\n quadratic form `Q` of the form\n\n .. MATH::\n\n d\\cdot x^2 + T(y,z,w)\n\n where `d > 0` is as small as possible.\n\n This is done by exhaustive search on small vectors, and then\n compar...
def disc(self): '\n Return the discriminant of the quadratic form, defined as\n\n - `(-1)^n {\\rm det}(B)` for even dimension `2n`\n - `{\\rm det}(B)/2` for odd dimension\n\n where `2Q(x) = x^t B x`.\n\n This agrees with the usual discriminant for binary and ternary quadratic forms.\n\n EXAMPLES...
def content(self): '\n Return the GCD of the coefficients of the quadratic form.\n\n .. warning::\n\n Only works over Euclidean domains (probably just `\\ZZ`).\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1, 1])\n sage: Q.matrix().gcd()\n 2\n sage: Q.content(...
def adjoint(self): '\n This gives the adjoint (integral) quadratic form associated to the\n given form, essentially defined by taking the adjoint of the matrix.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 2, [1,2,5])\n sage: Q.adjoint()\n Quadratic form in 2 variables over Integer...
def antiadjoint(self): '\n This gives an (integral) form such that its adjoint is the given form.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 3, [1, 0, -1, 2, -1, 5])\n sage: Q.adjoint().antiadjoint()\n Quadratic form in 3 variables over Integer Ring with coefficients:\n [ 1 0...
def is_adjoint(self) -> bool: '\n Determine if the given form is the adjoint of another form.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 3, [1, 0, -1, 2, -1, 5])\n sage: Q.is_adjoint() # needs sage.symbolic\n False\n ...
def reciprocal(self): '\n This gives the reciprocal quadratic form associated to the given form.\n\n This is defined as the multiple of the primitive adjoint with the same\n content as the given form.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,37])\n sage: Q.reciprocal()...
def omega(self): '\n Return the content of the adjoint of the primitive associated quadratic form.\n\n Ref: See Dickson\'s "Studies in Number Theory".\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,37])\n sage: Q.omega()\n 4\n ' return self.primitive().adjoint().c...
def delta(self): '\n Return the omega of the adjoint form.\n\n This is the same as the omega of the reciprocal form.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,37])\n sage: Q.delta()\n 148\n ' return self.adjoint().omega()
def level__Tornaria(self): '\n Return the level of the quadratic form.\n\n This is defined as\n\n - level(`B`) for even dimension,\n - level(`B`)/4 for odd dimension,\n\n where `2Q(x) = x^t\\cdot B\\cdot x`.\n\n This agrees with the usual level for even dimension.\n\n EXAMPLES::\n\n ...
def discrec(self): '\n Return the discriminant of the reciprocal form.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,37])\n sage: Q.disc()\n 148\n sage: Q.discrec()\n 5476\n sage: [4 * 37, 4 * 37^2]\n [148, 5476]\n ' return self.reciproca...
def hasse_conductor(self): '\n Return the Hasse conductor.\n\n This is the product of all primes where the Hasse invariant equals `-1`.\n\n EXAMPLES::\n\n sage: # needs sage.libs.pari\n sage: Q = QuadraticForm(ZZ, 3, [1, 0, -1, 2, -1, 5])\n sage: Q.hasse_invariant(2)\n -1\n ...
def clifford_invariant(self, p): '\n Return the Clifford invariant.\n\n This is the class in the Brauer group of the Clifford algebra for\n even dimension, of the even Clifford Algebra for odd dimension.\n\n See Lam (AMS GSM 67) p. 117 for the definition, and p. 119 for the formula\n relating it to...
def clifford_conductor(self): '\n Return the product of all primes where the Clifford invariant is `-1`.\n\n .. NOTE::\n\n For ternary forms, this is the discriminant of the\n quaternion algebra associated to the quadratic space\n (i.e. the even Clifford algebra).\n\n EXAMPLES::\n\n ...
def basiclemma(self, M): '\n Find a number represented by ``self`` and coprime to `M`.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 2, [2, 1, 3])\n sage: Q.basiclemma(6)\n 71\n ' a = self(self.basiclemmavec(M)) assert (gcd(a, M) == 1) return a
def basiclemmavec(self, M): '\n Find a vector where the value of the quadratic form is coprime to `M`.\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 2, [2, 1, 5])\n sage: Q.basiclemmavec(10)\n (6, 5)\n sage: Q(_)\n 227\n ' V = FreeModule(self.base_ring(), self.dim(...
def xi(self, p): '\n Return the value of the genus characters Xi_p... which may be missing one character.\n We allow -1 as a prime.\n\n REFERENCES:\n\n Dickson\'s "Studies in the Theory of Numbers"\n\n EXAMPLES::\n\n sage: Q1 = QuadraticForm(ZZ, 3, [1, 1, 1, 14, 3, 14])\n sage: Q2 = Q...
def xi_rec(self, p): '\n Return Xi(`p`) for the reciprocal form.\n\n EXAMPLES::\n\n sage: # needs sage.libs.pari\n sage: Q1 = QuadraticForm(ZZ, 3, [1, 1, 1, 14, 3, 14])\n sage: Q2 = QuadraticForm(ZZ, 3, [2, -1, 0, 2, 0, 50])\n sage: [Q1.clifford_conductor(), # equ...
def lll(self): '\n Return an LLL-reduced form of `Q` (using PARI).\n\n EXAMPLES::\n\n sage: Q = QuadraticForm(ZZ, 4, range(1,11))\n sage: Q.is_definite()\n True\n sage: Q.lll() # needs sage.libs.pari\n Quadr...
def representation_number_list(self, B): '\n Return the vector of representation numbers < B.\n\n EXAMPLES::\n\n sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1,1,1,1,1])\n sage: Q.representation_number_list(10) # needs sage.libs.pari\n [1, 16, 112,...
def representation_vector_list(self, B, maxvectors=(10 ** 8)): '\n Find all vectors `v` where `Q(v) < B`.\n\n This only works for positive definite quadratic forms.\n\n EXAMPLES::\n\n sage: # needs sage.libs.pari\n sage: Q = DiagonalQuadraticForm(ZZ, [1, 1])\n sage: Q.representation_...
def is_zero(self, v, p=0) -> bool: '\n Determine if the vector `v` is on the conic `Q(x) = 0` (mod `p`).\n\n EXAMPLES::\n\n sage: Q1 = QuadraticForm(ZZ, 3, [1, 0, -1, 2, -1, 5])\n sage: Q1.is_zero([0,1,0], 2)\n True\n sage: Q1.is_zero([1,1,1], 2)\n True\n sage: Q1.i...
def is_zero_nonsingular(self, v, p=0) -> bool: '\n Determine if the vector `v` is on the conic `Q(x) = 0` (mod `p`),\n and that this point is non-singular point of the conic.\n\n EXAMPLES::\n\n sage: Q1 = QuadraticForm(ZZ, 3, [1, 0, -1, 2, -1, 5])\n sage: Q1.is_zero_nonsingular([1,1,1], 2)\...
def is_zero_singular(self, v, p=0) -> bool: '\n Determine if the vector `v` is on the conic `Q(x) = 0` (mod `p`),\n and that this point is singular point of the conic.\n\n EXAMPLES::\n\n sage: Q1 = QuadraticForm(ZZ, 3, [1, 0, -1, 2, -1, 5])\n sage: Q1.is_zero([1,1,1], 2)\n True\n ...
def theta_series(self, Max=10, var_str='q', safe_flag=True): "\n Compute the theta series as a power series in the variable given\n in ``var_str`` (which defaults to ``'q'``), up to the specified precision\n `O(q^{Max})`.\n\n This uses the PARI/GP function :pari:`qfrep`, wrapped by the\n theta_by_p...
def theta_by_pari(self, Max, var_str='q', safe_flag=True): "\n Use PARI/GP to compute the theta function as a power series (or\n vector) up to the precision `O(q^{Max})`. This also caches the result\n for future computations.\n\n If ``var_str`` = ``''``, then we return a vector `v` where ``v[i]`` cou...
def theta_by_cholesky(self, q_prec): '\n Uses the real Cholesky decomposition to compute (the `q`-expansion of) the\n theta function of the quadratic form as a power series in `q` with terms\n correct up to the power `q^{\\text{q\\_prec}}`. (So its error is `O(q^\n {\\text{q\\_prec} + 1})`.)\n\n RE...
def theta_series_degree_2(Q, prec): "\n Compute the theta series of degree 2 for the quadratic form `Q`.\n\n INPUT:\n\n - ``prec`` -- an integer\n\n OUTPUT:\n\n dictionary, where:\n\n - keys are `{\\rm GL}_2(\\ZZ)`-reduced binary quadratic forms (given as triples of\n coefficients)\n - v...
def swap_variables(self, r, s, in_place=False): '\n Switch the variables `x_r` and `x_s` in the quadratic form\n (replacing the original form if the ``in_place`` flag is True).\n\n INPUT:\n\n - ``r``, ``s`` -- integers `\\geq 0`\n\n OUTPUT:\n\n a :class:`QuadraticForm` (by default, otherwise non...
def multiply_variable(self, c, i, in_place=False): '\n Replace the variables `x_i` by `c\\cdot x_i` in the quadratic form\n (replacing the original form if the ``in_place`` flag is True).\n\n Here `c` must be an element of the base ring defining the\n quadratic form.\n\n INPUT:\n\n - ``c`` -- an...
def divide_variable(self, c, i, in_place=False): '\n Replace the variables `x_i` by `(x_i)/c` in the quadratic form\n (replacing the original form if the ``in_place`` flag is True).\n\n Here `c` must be an element of the base ring defining the\n quadratic form, and the division must be defined in the ...
def scale_by_factor(self, c, change_value_ring_flag=False): '\n Scale the values of the quadratic form by the number `c`, if\n this is possible while still being defined over its base ring.\n\n If the flag is set to true, then this will alter the value ring\n to be the field of fractions of the origin...
def extract_variables(QF, var_indices): '\n Extract the variables (in order) whose indices are listed in\n ``var_indices``, to give a new quadratic form.\n\n INPUT:\n\n - ``var_indices`` -- a list of integers `\\geq 0`\n\n OUTPUT: a :class:`QuadraticForm`\n\n EXAMPLES::\n\n sage: Q = Quad...
def elementary_substitution(self, c, i, j, in_place=False): '\n Perform the substitution `x_i \\longmapsto x_i + c\\cdot x_j` (replacing the\n original form if the ``in_place`` flag is True).\n\n INPUT:\n\n - ``c`` -- an element of ``self.base_ring()``\n\n - ``i``, ``j`` -- integers `\\geq 0`\n\n ...
def add_symmetric(self, c, i, j, in_place=False): "\n Perform the substitution `x_j \\longmapsto x_j + c\\cdot x_i`, which has the\n effect (on associated matrices) of symmetrically adding\n `c` times the `j`-th row/column to the `i`-th row/column.\n\n NOTE: This is meant for compatibility with previo...
def random_quadraticform(R, n, rand_arg_list=[]): '\n Create a random quadratic form in `n` variables defined over the ring `R`.\n\n The last (and optional) argument ``rand_arg_list`` is a list of at most 3\n elements which is passed (as at most 3 separate variables) into the method\n ``R.random_eleme...
def random_quadraticform_with_conditions(R, n, condition_list=[], rand_arg_list=[]): '\n Create a random quadratic form in `n` variables defined over the ring `R`\n satisfying a list of boolean (i.e. True/False) conditions.\n\n The conditions `c` appearing in the list must be boolean functions which\n ...
def random_ternaryqf(rand_arg_list=[]): '\n Create a random ternary quadratic form.\n\n The last (and optional) argument ``rand_arg_list`` is a list of at most 3\n elements which is passed (as at most 3 separate variables) into the method\n ``R.random_element()``.\n\n INPUT:\n\n - ``rand_arg_lis...
def random_ternaryqf_with_conditions(condition_list=[], rand_arg_list=[]): '\n Create a random ternary quadratic form satisfying a list of boolean\n (i.e. True/False) conditions.\n\n The conditions `c` appearing in the list must be boolean functions which\n can be called either as ``Q.c()`` or ``c(Q)`...
def gamma__exact(n): '\n Evaluates the exact value of the `\\Gamma` function at an integer or\n half-integer argument.\n\n EXAMPLES::\n\n sage: gamma__exact(4)\n 6\n sage: gamma__exact(3)\n 2\n sage: gamma__exact(2)\n 1\n sage: gamma__exact(1)\n 1\n...
def zeta__exact(n): '\n Return the exact value of the Riemann Zeta function\n\n The argument must be a critical value, namely either positive even\n or negative odd.\n\n See for example [Iwa1972]_, p13, Special value of `\\zeta(2k)`\n\n EXAMPLES:\n\n Let us test the accuracy for negative special...
def QuadraticBernoulliNumber(k, d): '\n Compute `k`-th Bernoulli number for the primitive\n quadratic character associated to `\\chi(x) = \\left(\\frac{d}{x}\\right)`.\n\n EXAMPLES:\n\n Let us create a list of some odd negative fundamental discriminants::\n\n sage: test_set = [d for d in srange...
def quadratic_L_function__exact(n, d): '\n Return the exact value of a quadratic twist of the Riemann Zeta function\n by `\\chi_d(x) = \\left(\\frac{d}{x}\\right)`.\n\n The input `n` must be a critical value.\n\n EXAMPLES::\n\n sage: quadratic_L_function__exact(1, -4) ...
def quadratic_L_function__numerical(n, d, num_terms=1000): '\n Evaluate the Dirichlet L-function (for quadratic character) numerically\n (in a very naive way).\n\n EXAMPLES:\n\n First, let us test several values for a given character::\n\n sage: RR = RealField(100)\n sage: for i in range...
class TernaryQF(SageObject): '\n The ``TernaryQF`` class represents a quadratic form in 3 variables with coefficients in `\\ZZ`.\n\n INPUT:\n\n - ``v`` -- a list or tuple of 6 entries: ``[a,b,c,r,s,t]``\n\n OUTPUT:\n\n - the ternary quadratic form `a\\cdot x^2 + b\\cdot y^2 + c\\cdot z^2 + r\\cdot...
def find_all_ternary_qf_by_level_disc(N, d): '\n Find the coefficients of all the reduced ternary quadratic forms given its discriminant `d` and level `N`.\n\n If `N|4d` and `d|N^2`, then it may be some forms with that discriminant and level.\n\n EXAMPLES::\n\n sage: find_all_ternary_qf_by_level_d...
def find_a_ternary_qf_by_level_disc(N, d): '\n Find a reduced ternary quadratic form given its discriminant `d` and level `N`.\n If `N|4d` and `d|N^2`, then it may be a form with that discriminant and level.\n\n EXAMPLES::\n\n sage: Q1 = find_a_ternary_qf_by_level_disc(44, 11); Q1\n Ternary...
class PathAlgebra(CombinatorialFreeModule): '\n Create the path algebra of a :class:`quiver <DiGraph>` over a given field.\n\n Given a quiver `Q` and a field `k`, the path algebra `kQ` is defined as\n follows. As a vector space it has basis the set of all paths in `Q`.\n Multiplication is defined on ...
class QuiverHomSpace(Homset): "\n A homomorphism of quiver representations (of one and the same quiver)\n is given by specifying, for each vertex of the quiver, a homomorphism\n of the spaces assigned to this vertex such that these homomorphisms\n commute with the edge maps. This class handles the se...
class QuiverRepHom(CallMorphism): '\n A homomorphism of quiver representations (of one and the same quiver)\n is given by specifying, for each vertex of the quiver, a homomorphism\n of the spaces assigned to this vertex such that these homomorphisms\n commute with the edge maps. The domain and codoma...
class PathSemigroup(UniqueRepresentation, Parent): "\n The partial semigroup that is given by the directed paths of a quiver,\n subject to concatenation.\n\n See :mod:`~sage.quivers.representation` for a definition of this\n semigroup and of the notion of a path in a quiver.\n\n Note that a *partia...
class QuiverRepFactory(UniqueFactory): "\n A quiver representation is a diagram in the category of vector spaces whose\n underlying graph is the quiver. Giving a finite dimensional representation\n is equivalent to giving a finite dimensional right module for the path\n algebra of the quiver.\n\n ...
class QuiverRepElement(ModuleElement): "\n An element of a quiver representation is a choice of element from each\n of the spaces assigned to the vertices of the quiver. Addition,\n subtraction, and scalar multiplication of these elements is done\n pointwise within these spaces.\n\n INPUT:\n\n ...
class QuiverRep_generic(WithEqualityById, Module): "\n A generic quiver representation.\n\n This class should not be called by the user.\n\n Call :class:`QuiverRep` with ``option='values'`` (which is the default)\n instead.\n\n INPUT:\n\n - ``k`` -- ring, the base ring of the representation\n\n ...
class QuiverRep_with_path_basis(QuiverRep_generic): '\n The basis of the module must be closed under right multiplication by\n an edge; that is, appending any edge to the end of any path in the\n basis must result in either an invalid path or a valid path also\n contained in the basis of the module.\n...
class QuiverRep_with_dual_path_basis(QuiverRep_generic): '\n The basis of the module must be closed under left deletion of an edge; that\n is, deleting any edge from the beginning of any path in the basis must\n result in a path also contained in the basis of the module.\n\n INPUT:\n\n - ``k`` -- r...
def load_ipython_extension(*args): import sage.repl.ipython_extension sage.repl.ipython_extension.load_ipython_extension(*args)
def load_attach_mode(load_debug=None, attach_debug=None): '\n Get or modify the current debug mode for the behavior of\n :func:`load` and :func:`attach` on ``.sage`` files.\n\n In debug mode, loaded or attached ``.sage`` files are preparsed\n through a file to make their tracebacks more informative. I...
def load_attach_path(path=None, replace=False): '\n Get or modify the current search path for :func:`load` and\n :func:`attach`.\n\n INPUT:\n\n - ``path`` -- string or list of strings (default: ``None``);\n path(s) to append to or replace the current path.\n\n - ``replace`` -- boolean (default...
def reset_load_attach_path(): "\n Reset the current search path for :func:`load` and :func:`attach`.\n\n The default path is ``'.'`` plus any paths specified in the\n environment variable ``SAGE_LOAD_ATTACH_PATH``.\n\n EXAMPLES::\n\n sage: load_attach_path()\n ['.']\n sage: t_dir ...
def attach(*files): '\n Attach a file or files to a running instance of Sage and also load\n that file.\n\n .. NOTE::\n\n Attaching files uses the Python inputhook, which will conflict\n with other inputhook users. This generally includes GUI main loop\n integrations, for example tki...
def add_attached_file(filename): "\n Add to the list of attached files\n\n This is a callback to be used from\n :func:`~sage.repl.load.load` after evaluating the attached\n file the first time.\n\n INPUT:\n\n - ``filename`` -- string, the fully qualified file name.\n\n EXAMPLES::\n\n s...
def attached_files(): '\n Returns a list of all files attached to the current session with\n :meth:`attach`.\n\n OUTPUT:\n\n The filenames in a sorted list of strings.\n\n EXAMPLES::\n\n sage: sage.repl.attach.reset()\n sage: t = tmp_filename(ext=\'.py\')\n sage: with open(t,\'...
def detach(filename): '\n Detach a file.\n\n This is the counterpart to :meth:`attach`.\n\n INPUT:\n\n - ``filename`` -- a string, or a list of strings, or a tuple of strings.\n\n EXAMPLES::\n\n sage: sage.repl.attach.reset()\n sage: t = tmp_filename(ext=\'.py\')\n sage: with o...
def reset(): '\n Remove all the attached files from the list of attached files.\n\n EXAMPLES::\n\n sage: sage.repl.attach.reset()\n sage: t = tmp_filename(ext=\'.py\')\n sage: with open(t,\'w\') as f: _ = f.write("print(\'hello world\')")\n sage: attach(t)\n hello world\n ...