For any nonsquare integer D congruent to 0 or 1 modulo 4, binary quadratic forms of discriminant D may be created. The parent object of forms of discriminant D can be created using the following commands.
Create the structure of integral binary quadratic forms of discriminant D.
Binary quadratic forms may be created by coercing a triple [a, b, c] of integer coefficients into the parent structure of forms of discriminant D = b2 - 4ac. Other constructors are provided for constructing the group identity, prime forms, or allowing the omission of third element c of the sequence.
Create the principal form in the structure Q of binary quadratic forms of discriminant D. The principal form is a reduced form equivalent to X2 - D/4Y2 when D ≡ 0 mod 4, or X2 + XY - (D - 1)/4Y2 when D ≡ 1 mod 4.
Returns the binary quadratic form aX2 + bXY + cY2 in the magma of forms Q of discriminant D. Here c is determined by the solution of the equality D = b2 - 4ac; if no integer c exists satisfying this, an error will occur.
If p is a split prime or a ramified prime not dividing the conductor of the magma of quadratic forms Q, returns a quadratic form pX2 + bXY + cY2 in Q.