Ask Your Question

Revision history [back]

The method is_globally_equivalent_to answers this and provides the matrix:

sage: QA = QuadraticForm(QQ, 4, [4, -12, 8, -4, 12, -16, 8, 6, -6, 2])
sage: QB = QuadraticForm(QQ, 4, [2, -2, -2, -2, 2, 0, 0, 2, 0, 2])
sage: X = QA.is_globally_equivalent_to(QB, return_matrix=True); X
[ 0  0  0  1]
[ 0  0  1  0]
[ 0  1  1 -1]
[ 1  1 -1 -1]
sage: X.transpose()*QA.matrix()*X == QB.matrix()
True

This calls the PARI function qfisom, which implements an algorithm of Plesken and Souvignier.