Ask Your Question

quadratic form over the integers with odd coefficients

asked 2014-12-11 14:23:36 +0200

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 22:31:54 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-11 19:27:02 +0200

slelievre gravatar image

updated 2014-12-13 10:42:30 +0200

[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 09:20:58 +0200 )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 18:42:03 +0200 )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 14:23:36 +0200

Seen: 2,593 times

Last updated: Dec 13 '14