Creation Functions

Contents

Creation of Structures

The rational field Q is automatically created when Magma is started up. Nevertheless, it may be necessary to formally create the rational field, for instance if it is to be used as the coefficient ring for a polynomial ring. There is a unique rational field structure in Magma, that is, multiple calls to the creation function RationalField() will return the same object (and not an isomorphic copy), so no memory will be wasted.

Rationals() : -> FldRat
RationalField() : -> FldRat
Create the field Q of rational numbers.
MaximalOrder(Q) : FldRat -> RngInt
IntegerRing(Q) : FldRat -> RngInt
IntegerRing() : -> RngInt
Integers() : -> RngInt
RingOfIntegers(Q) : FldRat -> RngInt
Create the field Z of rational integers.
FieldOfFractions(Q) : FldRat -> FldRat
FieldOfFractions(Z) : RngInt -> FldRat
The function FieldOfFractions returns the field Q when R is either the ring Z of rational integers, or the field Q itself.
Completion(Q, P) : FldRat, RngInt -> FldLoc, Map
    Precision: RngIntElt                Default: ∞
Computes the completion of Q at the integral prime ideal P together with the injection into the completion.

The parameter Precision may be used to specify a particular precision.

Creation of Elements

Unlike elements of other structures, rational numbers and integers can be created as literals without the need to define the parent field Q or the parent ring Z first, since these structures are loaded whenever Magma is started up.

One(Q) : FldRat -> FldRatElt
Identity(Q) : FldRat -> FldRatElt
Zero(Q) : FldRat -> FldRatElt
Representative(Q) : FldRat -> FldRatElt

These generic functions create 1, 1, 0, and 0 respectively, in the rational field Q.

a / b : RngIntElt, RngIntElt -> FldRatElt
Given integers a and b != 0, form the rational number a/b (in reduced form). Of course a and be are allowed to be given as expressions defining integers.
Q ! [a] : FldRat, RngElt -> FldRatElt
The inverse function to Eltseq, returns Q!a.
Q ! [a, b] : FldRat, RngIntElt, RngIntElt -> FldRatElt
elt< Q | a, b > : FldRat, RngIntElt, RngIntElt -> FldRatElt
Given the rational field Q, and integers a, b (with b != 0), construct the rational number a / b, in reduced form.
Q ! a : FldRat, RngIntElt -> FldRatElt
Given the rational field Q, and an integer a, create the rational number a=a/1 in Q. Also, any element from a quadratic, cyclotomic or number field (or an order of such) that is rational can be coerced into the rational field this way.
RootOfUnity(n, Q) : RngIntElt, FldRat -> FldRatElt
This function returns, in general, for a positive integer n and a cyclotomic field Q a primitive n-th root of unity in Q; if Q is the rational field, n must be 1 or 2, and the result will be 1 or -1 in Q accordingly.
Random(Q, m) : FldRat, RngIntElt -> FldRatElt
This function returns a random rational number with random numerator in [ - u..u] and random denominator in [ 1..u], where u is the absolute value of m.
V2.28, 13 July 2023