In Magma, the class group of binary quadratic forms of discriminant D is defined by the equivalence relation IsEquivalent(f1, f2 : Narrow := false) for forms f1, f2. It is the same as the ideal class group (PicardGroup) of the quadratic order of discriminant D. The class group of binary forms for D > 0 is usually defined using standard ("narrow") equivalence of forms, which agrees with the narrow ideal class group of the order. For D < 0, there is no difference. For D > 0, the two class groups differ if and only if all units in the quadratic order have norm 1. When they are different, each class is the union of two narrow classes: forms < a, b, c > and < - a, b, - c > are equivalent but not narrowly equivalent.
Al: MonStgElt Default: "Automatic"
FactorBasisBound: FldReElt Default: 0.1
ProofBound: FldReElt Default: 6
ExtraRelations: RngIntElt Default: 1
This returns the class number of binary quadratic forms Q of discriminant D.The parameter Al may be supplied to select the method used to calculate the class number. The possible values are "ReducedForms" (enumerating all reduced forms), "Shanks" (using a Shanks-based algorithm in the class group), "Sieve" or "NoSieve". The default is to use reduced form enumeration for small discriminants, the Shanks algorithm for the middle range, a class group index-calculus for large discriminants and the sieve method described in [Jac99] for very large discriminants.
The parameters FactorBasis-Bound, ProofBound and ExtraRelations are relevant only for the index calculus algorithm. They are described (below) under ClassGroup.
Al: MonStgElt Default: "Automatic"
FactorBasisBound: FldReElt Default: 0.1
ProofBound: FldReElt Default: 6
ExtraRelations: RngIntElt Default: 1
This computes the class group of binary quadratic forms of discriminant D. The function returns the class group as an abelian group, together with a map from the group to quadratic forms.Important: the class group is defined using non-strict equivalence (see the introduction to this subsection).
Depending on the size of D, either a Shanks-based method is used ([Tes98], [BJT97]), an index calculus variant ([CDO93], [HM89], [Coh93]) or a sieving method ([Jac99]). If the parameter Al is set to "Sieve" or D is larger than 1020, then the sieving method is used. The results are only proven under GRH. If the parameter Al is set to "NoSieve" then the sieving method will not be used.
The parameters FactorBasisBound, ProofBound and ExtraRelations apply to the index calculus method only. This method performs two steps. In the first step a factor basis containing prime forms of norm < B1 is built. Next, one looks for generators for the full lattice of relations between the forms in the factor basis. The determinant of this lattice will be the class number and the Smith-form of the relation matrix gives the structure of the class group. Once the matrix is of full rank, the algorithm will look for ExtraRelations more relations to potentially decrease the discriminant. In the second step, for all prime forms of norm < B2 it is verified that they are in the class group generated by the forms of the first step. The bounds are chosen to be B1 := FactorBasisBound.log2 |D| and B2 := ProofBound.log2 |D|, so the result is correct under the assumption of GRH. The final result is then checked against the Euler product over the first 30000 primes. If the quotient becomes too large, a warning is issued. In this case one should increase the ExtraRelations parameter.
The structure of the class group of the binary quadratic forms Q of discriminant D returned as a sequence of integers giving the abelian invariants.The parameters are the same as for ClassGroup.
Enumerates the ambiguous forms of negative discriminant D, where D is the discriminant of the magma of binary quadratic forms Q.
The subgroup of 2--torsion elements of in the class group of Q.
> Q<z> := QuadraticField(7537543); // arbitrary choice > Q := QuadraticForms(Discriminant(Q)); > C, m := ClassGroup(Q); > C; Abelian Group isomorphic to Z/2 + Z/76 Defined on 2 generators Relations: 76*C.1 = 0 2*C.2 = 0 > // get the generators as quadratic forms: > f := m(C.1); > g := m(C.2); > h := g^2; > g, h; <-1038,4894,1493> <-887,4340,3189> > c := []; // create the cycle of forms equivalent to g^2: > repeat > h := ReductionStep(h); > Append(~c, h); > until h eq g^2; > P := Parent(g); > Identity(P) in c; true // this proves that the second class has order dividing 2 > for d in Divisors(76) do > c := []; > h := f^d; > repeat h := ReductionStep(h); Append(~c, h); > until h eq f^d; > d, Identity(P) in c, #c; > end for; 1 false 16 2 false 14 4 false 12 // the cycle lengths vary 19 false 18 38 false 16 76 true 14 // so the true order of this class is 76