Ask Your Question

quadratic form over the integers with odd coefficients

asked 2014-12-11 07:23:36 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.


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  ]


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 flag offensive close merge delete


If you are interested in binary quadratic forms this may be of interest for you:

Peter Luschny gravatar imagePeter Luschny ( 2014-12-12 15:31:54 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-12-11 12:27:02 -0500

updated 2014-12-13 03:42:30 -0500

[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
edit flag offensive delete link more



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.

Basile gravatar imageBasile ( 2014-12-12 02:20:58 -0500 )edit

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

slelievre gravatar imageslelievre ( 2014-12-12 11:42:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-12-11 07:23:36 -0500

Seen: 2,385 times

Last updated: Dec 13 '14