Operations on Structures

The majority of functions for quadratic fields and orders apply identically to number fields and orders in general. The functions which exist only for quadratic fields and orders are listed here along with those which deserve a special mention.

Contents

AssignNames(~F, [s]) : FldQuad, [ MonStgElt ]) ->
AssignNames(~O, [s]) : RngQuad, [ MonStgElt ]) ->
Procedure to change the name of the generator of a quadratic field F or an order O in a quadratic field to the string s. Elements of the quadratic field Q(Sqrt(d)) with m squarefree will be printed in the form 1/b*(x + y*s), where b, x, y are integers. Similarly, for an order O of conductor f in a quadratic field elements will be printed in the format x + y*s.

This procedure only changes the name used in printing the elements of F or O, it does not make an assignment to an identifier s. To do this, use an assignment statement, or angle brackets when creating the field or order: F<s> := QuadraticField(-3);.

Note that since this is a procedure that modifies F or O, it is necessary to have a reference ~ in the call to this function.

Name(F, 1) : FldQuad, RngIntElt -> FldQuadElt
Name(O, 1) : RngQuad, RngIntElt -> RngQuadElt
Given a quadratic field F or one of its orders O, return the element which has the name attached to it, that is, return Sqrt(d) in the field, or f εd in a suborder of the maximal order or f Sqrt(d) in a suborder of the equation order.
FundamentalUnit(K) : FldQuad -> FldQuadElt
FundamentalUnit(O) : RngQuad -> RngQuadElt
A generator for the unit group of the order O or the maximal order of the quadratic field K.
Discriminant(K) : FldQuad -> RngIntElt
The discriminant of the field K which is only defined up to squares. The discriminant will be the discriminant of the polynomial or better.
Conductor(K) : FldQuad -> RngIntElt, [RngIntElt]
The conductor of the field K which is the order of the smallest cyclotomic field containing K and a sequence containing the ramified real places of K.
Conductor(O) : RngQuad -> RngIntElt
The conductor of the order O, which equals the index of O in the maximal order.

Ideal Class Group

The function ClassGroup is available for number fields and orders in general but a different and faster algorithm is used by default for the quadratics. All of the algorithms, except for the sieving method described in [Jac99] which uses the multiple polynomial quadratic sieve (MPQS), are based on binary quadratic forms, see ClassGroup in Chapter BINARY QUADRATIC FORMS for details.

ClassGroup(K) : FldQuad -> GrpAb, Map
ClassGroup(O) : RngQuad -> GrpAb, Map
    FactorBasisBound: FldReElt          Default: 0.1
    ProofBound: FldReElt                Default: 6
    ExtraRelations: RngIntElt           Default: 1
    Al: MonStgElt                       Default: "Automatic"
    SetVerbose("ClassGroupSieve", n):   Maximum: 5
The class group of a maximal order O or the maximal order of the quadratic field K, as an abelian group. The function also returns a map between the group and the power structure of ideals of O or the maximal order of K. The parameter Al can be set to "Sieve" or "NoSieve" to control whether the sieving algorithm is used or not; by default it is used when the discriminant is greater than 1020. For more details on the parameters see ClassGroup in Chapter BINARY QUADRATIC FORMS.
ClassNumber(K) : FldQuad -> RngIntElt
ClassNumber(O) : RngQuad -> RngIntElt
    FactorBasisBound: FldReElt          Default: 0.1
    ProofBound: FldReElt                Default: 6
    ExtraRelations: RngIntElt           Default: 1
    Al: MonStgElt                       Default: "Automatic"
The class number of the maximal order O or the maximal order of the quadratic field K.
PicardGroup(O) : RngQuad -> GrpAb, Map
PicardNumber(O) : RngQuad -> RngIntElt
    FactorBasisBound: FldReElt          Default: 0.1
    ProofBound: FldReElt                Default: 6
    ExtraRelations: RngIntElt           Default: 1
    Al: MonStgElt                       Default: "Automatic"
The picard group (the group of the invertible ideals of O modulo the principal ones) of the order O or the size of this group. PicardGroup also returns a map from the group to the ideals of O.

Example FldQuad_quad_sieve (H37E3)

We give examples of class group calculations using sieving. We also show the use of the mapping between the group and the set of ideals. First a field with negative discriminant.
> D:=-(10^(30) + 3 );
> K := QuadraticField(D);
> time G, m := ClassGroup(K : Al := "Sieve");
Time: 10.750
> G, m;
Abelian Group isomorphic to Z/125355959329602
Defined on 1 generator
Relations:
    125355959329602*G.1 = 0
Mapping from: GrpAb: G to Set of ideals of Maximal Order of K
> m(G.1);
Ideal
Two element generators:
    385706622580333
    148769598702327446467038390888*$.2 + 307255216496036
> $1 @@ m;
G.1
And now a field with positive discriminant.
> K := QuadraticField(NextPrime(10^24));
> time G, m := ClassGroup(K : Al := "Sieve");
Time: 3.330
> G, m;
Abelian Group isomorphic to Z/3
Defined on 1 generator
Relations:
    3*$.1 = 0
Mapping from: GrpAb: G to Set of ideals of Maximal Equation Order of K
> m(G.1);
Ideal
Two element generators:
    3847
    $.2 + 616
> $1 @@ m;
G.1
> IsPrincipal($2^3);
true
QuadraticClassGroupTwoPart(K) : FldQuad -> GrpAb, Map
QuadraticClassGroupTwoPart(O) : RngQuad -> GrpAb, Map
QuadraticClassGroupTwoPart(d) : RngIntElt -> GrpAb, Map
    Factorization: RngIntEltFact        Default: []
Use the Bosma-Stevenhagen algorithm to compute the 2-part of the class group of a quadratic order. Returned are: an array of forms that generates the 2-part and an array that gives the orders of the respective elements. The Factorization of the given discriminant can be given as additional information.

Example FldQuad_qcgtp (H37E4)

> G, f := QuadraticClassGroupTwoPart(33923894057872); G;
Abelian Group isomorphic to Z/2 + Z/2 + Z/2 + Z/4 + Z/16 + Z/16
> Random(G);
11*G.1 + 2*G.2 + G.3 + G.4 + G.6
> f($1);
<-1212992,3947508,3780131>
> G, f := QuadraticClassGroupTwoPart(QuadraticField(33923894057872)); G;
Abelian Group isomorphic to Z/2 + Z/8 + Z/16

Norm Equations

For imaginary quadratic fields, (that is, for quadratic fields Q(√m) with m < 0), the function NormEquation is provided specially for quadratics to find integral elements of a given norm. For real quadratic fields conics are used, see Section Finding Points for details.

NormEquation(F, m) : FldQuad, RngIntElt -> BoolElt, SeqEnum
NormEquation(F, m: parameters) : FldQuad, RngIntElt -> BoolElt, SeqEnum
NormEquation(O, m) : RngQuad, RngIntElt -> BoolElt, SeqEnum
NormEquation(O, m: parameters) : RngQuad, RngIntElt -> BoolElt, SeqEnum
    Factorization: [<RngIntElt, RngIntElt>] Default: 
    All: BoolElt                        Default: true
    Solutions: RngIntElt                Default: All
    Exact: BoolElt                      Default: false
    Ineq: BoolElt                       Default: false
    SetVerbose("NormEquation", n):      Maximum: 1
Given quadratic field F and a non-negative integer m, return true if there exists an element α in the ring of integers OF of F with norm m, and false otherwise. Instead of searching the maximal order OF it is possible to search any suborder O of OF for such element α by supplying O as a first argument.

For imaginary quadratic fields the method used is constructive (it uses Cornacchia's algorithm, see [Coh93] section 1.5.2), and if the value true is returned then a solution [x] is also returned as a second return value.

Note that if the discriminant F=Q(Sqrt(d)) with d ≡ 1bmod4 (and squarefree) this function searches for a solution in integers to x2 + y2d=4m (and the solution α=(x + ySqrt(d)/2) is returned), whereas for d ≡ 2, 3bmod4 a solution α=x + ySqrt(d) with x2 + y2d=m in integers x, y is returned, if it exists. In an order of conductor f a search is conducted for a solution to the same equation with d replaced by f2d. Note that a version of NormEquation with integer arguments d and m also exists (see Section The Solution of Modular Equations).

Unless m is the square of an integer, the factorization of m is used by the algorithm; if it is known, it may be supplied as the value of the optional parameter Factorization to speed up the calculation.

A verbose flag can be set to obtain some information on progress with the computation (see SetVerbose).

For real quadratic fields the same algorithm is used as for the general number fields. The last 4 parameters refer to this algorithm. See Section Solving Norm Equations for a description.

Example FldQuad_norm-equation (H37E5)

> d := 302401481761723680;
> m := 76814814791186002463716;
> Q<z> := QuadraticField(-d);
> O<w> := sub< MaximalOrder(Q) | 6 >;
> f, s := NormEquation(O, m);
> s, Norm(s[1]);
406 + 1008*w 76814814791186002463716
V2.28, 13 July 2023