# Creation Functions

## Creation of Structures

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.

### `BinaryQuadraticForms(D): RngIntElt -> QuadBin`

### `QuadraticForms(D): RngIntElt -> QuadBin`

Create the structure of integral binary quadratic forms of discriminant $D$.

## Creation of Forms

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 = b^2-4ac$. Other constructors are provided for constructing the group identity, prime forms, or allowing the omission of third element $c$ of the sequence.

### `Identity(Q): QuadBin -> QuadBinElt`

### `Q ! 1: QuadBin, RngIntElt -> QuadBinElt`

Create the principal form in the structure $Q$ of binary quadratic forms of discriminant $D$. The principal form is a reduced form equivalent to $X^2-D/4Y^2$ when $D \equiv 0 \bmod 4,$ or $X^2+XY-(D-1)/4Y^2$ when $D \equiv 1 \bmod 4$.

### `Q ! [a, b, c]: QuadBin, RngIntElt, RngIntElt, RngIntElt -> QuadBinElt`

### `elt< Q | a, b, c>: QuadBin, RngIntElt, RngIntElt, RngIntElt -> QuadBinElt`

### `elt< Q | a, b>: QuadBin, RngIntElt, RngIntElt -> QuadBinElt`

Returns the binary quadratic form $aX^2+bXY+cY^2$ in the magma of forms $Q$ of discriminant $D$. Here $c$ is determined by the solution of the equality $D = b^2-4ac$; if no integer $c$ exists satisfying this, an error will occur.

### `PrimeForm(Q, p): QuadBin, RngIntElt -> QuadBinElt`

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 $pX^2+bXY+cY^2$ in $Q$.
