# quadratic form over the integers with odd coefficients This post is a wiki. Anyone with karma >750 is welcome to improve it.

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 + 4x0x1 + 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.

edit retag close merge delete

Sort by » oldest newest most voted

[Edited 2014-12-12, 2014-12-13.]

The documentation on Quadratic forms indeed documents this restriction.

You can access this documentation within Sage by typing QuadraticForm?. You can view the source code by typing QuadraticForm??.

You can also access this documentation online. On the online documentation for quadratic forms in Sage, the "Next Topic" is Binary Quadratic Forms with Integer Coefficients, which does not have this restriction.

So if your quadratic forms are only in two variables, use BinaryQF. Here the quadratic form you gave as an example:

sage: Q = BinaryQF([1,4,3])
sage: Q
x^2 + 4*x*y + 3*y^2

more

2

I carefully read both the documentation and the source code before asking. Still no explanation why, for instance, they ask matrices of quadratic forms over the integers to have even diagonal ! Following this constructor it seems impossible to define x^2 as a quadratic form over ZZ.

Sorry, my initial answer was not very helpful. I edited to point to Binary quadratic forms with integer coefficients.