ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 03 Jul 2020 16:38:09 -0500Bug in solving quadratic equationshttps://ask.sagemath.org/question/52315/bug-in-solving-quadratic-equations/I would like to use the QuadraticForm solve() method to find vectors of given length in root lattices. Unfortunately this method often produces the answer 0.
A minimal example: to find a vector in the E8 lattice of length two:
> QuadraticForm(QQ, CartanMatrix(['E', 8])).solve(2)
yields
> (0, 0, 0, 0, 0, 0, 0, 0)btw47Fri, 03 Jul 2020 16:38:09 -0500https://ask.sagemath.org/question/52315/Overhead of isometry testing of quadratic formshttps://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/ I have a script that generates a bunch of locally isomorphic quadratic forms and then tests them for global isometry. This script is too slow. Looking at profiling data much of the runtime is spent in the Quadratic forms class computing the useless local invariants and very little in the Pari qfisom calls. What can I do to cut down on this overhead?
watson_laddTue, 05 Dec 2017 15:22:06 -0600https://ask.sagemath.org/question/39957/Corresponding value of a parameterhttps://ask.sagemath.org/question/39911/corresponding-value-of-a-parameter/Hello,
I am quite new to Sage and I have the following question.
In my computations I have a quadratic form: **$x^T A x = b $** ,
where the matrix A is defined already as a symmetric matrix, and x is defined as
import itertools
X = itertools.product([0,1], repeat = n)
for x in X:
x = vector(x)
print x
as all combination of $[0,1]$ repeated n times. I got a set of values for **$b$** and extracted few of them from the set. Now, I need to identify which **$x$** is corresponding to a particular value of **$b$**. Is there any command to do so? If it is possible. Thank you for help.XeniaSat, 02 Dec 2017 07:38:04 -0600https://ask.sagemath.org/question/39911/quadratic formhttps://ask.sagemath.org/question/38132/quadratic-form/> Write a function in Sage that accepts as input a symmetrical bilinear (not trivial) form B [caracterized by the associated matrix respect to the canonical base in R^n] and gives in output a vector subspace W ⊆ R^n such that:
- Dim W is maximal
- the restriction B|wxw has maximum rankciaoThu, 29 Jun 2017 18:17:32 -0500https://ask.sagemath.org/question/38132/Bilinear formhttps://ask.sagemath.org/question/38131/bilinear-form/ Write a function in Sage that accepts as input a symmetrical bilinear (not trivial) form B [caracterized by the associated matrix respect to the canonical base in R^n] and gives in output a vector subspace W ⊆ R^n such that:
- Dim W=n
- the restriction of B to WxW has maximum rankciaoThu, 29 Jun 2017 18:16:17 -0500https://ask.sagemath.org/question/38131/Series expansion for theta function of even latticehttps://ask.sagemath.org/question/38050/series-expansion-for-theta-function-of-even-lattice/I am new to sage and trying to figure out how to calculate the series expansion of the theta function for an even lattice $L$, i.e. $$\Theta_L(q)=\sum_{x\in L} q^{\langle x,x\rangle/2}$$
I tried the following code for the $A_2$ lattice, but I doesn't really do what its supposed to do
<pre>
Q=QuadraticForm(QQ,2,[2,-1,2]); Q
Q.theta_series(20)
</pre>
I found the following code on [OEIS](https://oeis.org/A004016), which gives the correct result:
<pre>
ModularForms( Gamma1(3), 1, prec=81).0
</pre>MarcelWed, 21 Jun 2017 19:45:53 -0500https://ask.sagemath.org/question/38050/witt index of quadratic formhttps://ask.sagemath.org/question/36141/witt-index-of-quadratic-form/An important invariant of quadratic forms $(V,q)$ over a field is the Witt index, the dimension of a maximal isotropic subspace of $V$.
Is Sage able to calculate this? I have checked http://doc.sagemath.org/html/en/reference/quadratic_forms/sage/quadratic_forms/quadratic_form.html and there does not seem to be anything there to help me (but I may have overlooked it).user58293Sun, 01 Jan 2017 14:09:29 -0600https://ask.sagemath.org/question/36141/quadraticform rational_diagonal_form?https://ask.sagemath.org/question/35985/quadraticform-rational_diagonal_form/I don't understand the factor of "2" ; which also appears in my real problem.
Here is the sample code from
doc.sagemath.org/html/en/reference/quadratic_forms/sage/quadratic_forms/quadratic_form.html#sage.quadratic_forms.quadratic_form.QuadraticForm.rational_diagonal_form
Q = QuadraticForm(ZZ, 4, range(10))
D, T = Q.rational_diagonal_form(return_matrix=True)
D
[ -1/16 0 0 0 ]
[ * 4 0 0 ]
[ * * 13 0 ]
[ * * * 563/52 ]
but
T.transpose() * Q.matrix() * T
[ -1/8 0 0 0]
[ 0 8 0 0]
[ 0 0 26 0]
[ 0 0 0 563/26]
Off by a factor of 2?
The description says.
OUTPUT: either D (if return_matrix is false) or (D,T) (if return_matrix is true) where
D – the diagonalized form of this quadratic form.
T – transformation matrix. This is such that T.transpose() * self.matrix() * T gives D.matrix().**
RayrrogersMon, 12 Dec 2016 09:34:50 -0600https://ask.sagemath.org/question/35985/Solution of quadratic formshttps://ask.sagemath.org/question/26546/solution-of-quadratic-forms/ If I have a quadratic form like (in the rational numbers)
`452*X^2 - 628*Y^2 + 356*Z^2 + 80*X*Y + 724*X*Z + 56*Y*Z == 0`
Can SAGE give me a few solutions? Or even solutions in p-adic integers?OderynWed, 15 Apr 2015 15:27:12 -0500https://ask.sagemath.org/question/26546/quadratic form over the integers with odd coefficientshttps://ask.sagemath.org/question/25216/quadratic-form-over-the-integers-with-odd-coefficients/ Hi,
I'm a newcomer in Sage, and even after thorough examination of the manual I cannot understand the constructor QuadraticFrom :
sage: Q = QuadraticForm(ZZ, 2, [1,2,3])
sage: Q
Quadratic form in 2 variables over Integer Ring with coefficients:
[ 1 2 ]
[ * 3 ]
But
sage: Q.polynomial()
2*x0^2 + 4*x0*x1 + 6*x1^2
So how do I construct a quadratic form with odd coefficients in its polynomial expression ? The polynomial x0^2 + 4*x0*x1 + 3*x1^2 defines a genuine quadratic form over the integers. Is it made on purpose for some reasons related to classification of lattices ?
Thank you.BasileThu, 11 Dec 2014 07:23:36 -0600https://ask.sagemath.org/question/25216/Reduction from the quadratic form to the canonical formhttps://ask.sagemath.org/question/24756/reduction-from-the-quadratic-form-to-the-canonical-form/ I have not found this function. Does it exist? Also i would like to get also the transformation matrix.ArtjomMon, 03 Nov 2014 07:43:37 -0600https://ask.sagemath.org/question/24756/Is this a bug in QuadraticForm?https://ask.sagemath.org/question/11042/is-this-a-bug-in-quadraticform/ QuadraticForm(ZZ, 2, [3, 2, 0]).lll()
gives a ValueError: a matrix from Full MatrixSpace of 2 by 1 dense matrices over
Integer Ring cannot be converted to a matrix in Full MatrixSpace of 2 by
2 dense matrices over Integer Ring!
Is this a bug or am I missing some precondition?petropolisSat, 21 Jun 2014 22:00:16 -0500https://ask.sagemath.org/question/11042/Hyperbolic forms over Qp(2)https://ask.sagemath.org/question/9401/hyperbolic-forms-over-qp2/Is this a bug in Sage or am I doing something wrong:
q = DiagonalQuadraticForm(QQ, [1,1,-1,-1])
q.is_hyperbolic(2)
The answer should be clearly `true`, but Sage return `false`???
pkoprowskiThu, 14 Feb 2013 05:02:14 -0600https://ask.sagemath.org/question/9401/How to restrict a quadratic form to a sublatticehttps://ask.sagemath.org/question/9536/how-to-restrict-a-quadratic-form-to-a-sublattice/If I have quadratic form, is there an easy way to find what the quadratic form is when restricted to a (finite index) sublattice?Paul JohnsonWed, 14 Nov 2012 09:12:29 -0600https://ask.sagemath.org/question/9536/