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().**
Ray