Quadratic fields in Magma can be created as a subtype of the number fields FldNum. The advantage of the special quadratic fields is that some special (faster) algorithms have been or will be implemented to deal with them; the functions for the special quadratic fields (created with the QuadraticField function) are described here. Functions which work generally for number fields and their orders are described in Chapter NUMBER FIELDS.
The categories involved are FldQuad for fields, RngQuad for their orders and FldQuadElt and RngQuadElt for their elements.
For every squarefree integer d (not 0 or 1) there is a unique quadratic field Q(Sqrt(d)); for any integer k we have the field Q(Sqrt(k2d)) isomorphic to Q(Sqrt(d)). Given any integer m, the function QuadraticField will create a structure corresponding to the quadratic field Q(Sqrt(d)), where d is the squarefree kernel of m (d will have the same sign as m and its absolute value is the largest squarefree divisor of m). In Magma a list of quadratic fields currently present is maintained, and if Q(Sqrt(d)) has been created before a reference on it will be returned: two fields with the same d are the same. The discriminant D of Q(Sqrt(d)) will be D=d if d ≡ 1bmod4 and D=4d if d equiv2, 3bmod4.
Elements of Q(Sqrt(d)) are represented by a common positive denominator b and two integer coefficients: α=(1/b)(x + ySqrt(d)).
The ring of integers of F=Q(Sqrt(d)) will be OF=Z + εdZ, where
εd=cases(
Sqrt(d)&if d ≡ 2, 3 mod 4,
(1 + Sqrt(d)/2)&if d ≡ 1 mod 4.
)
Elements of OF are represented by two integer coefficients α=x + yεd.
The pair 1, εd forms an integral basis for F=Q(Sqrt(d)),
but note that elements of F are represented using the basis of the
equation order (1, Sqrt(d)) instead.
For any positive integer f there is a suborder of conductor f in OF, whose elements are of the form x + y f εd, for any integers x, y. The discriminant of the order of conductor f is f2D, where D is the field discriminant.
The equation order of F is EF = Z + Sqrt(d)Z. Suborders of conductor f can be formed which will contain elements of the form x + y f Sqrt(d) for any integers x and y.