[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Creation Functions

Creation Functions

Subsections

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() : Null -> FldRat
RationalField() : Null -> FldRat
Create the field Q of rational numbers.
IntegerRing(Q) : FldRat -> RngInt
IntegerRing() : Null -> RngInt
Integers() : Null -> 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.

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, 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.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]