Creation Functions
Creation of Structures
The rational field \({\mathbb{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 \({\mathbb{Q}}\) of rational numbers.
- MaximalOrder(Q): FldRat -> RngInt
- IntegerRing(Q): FldRat -> RngInt
- IntegerRing() -> RngInt
- Integers() -> RngInt
- RingOfIntegers(Q): FldRat -> RngInt
Create the field \({\mathbb{Z}}\) of rational integers.
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 \({\mathbb{Q}}\) or the parent ring \({\mathbb{Z}}\) first, since these structures are loaded whenever Magma is started up.
- a / b: RngIntElt, RngIntElt -> FldRatElt
Given integers \(a\) and \(b\neq 0\), form the rational number \(a/b\) (in reduced form). Of course \(a\) and \(b\) are allowed to be given as expressions defining integers.
- Q ! [a]: FldRat, RngElt -> FldRatElt
The inverse function to
Eltseq, returnsQ!a.
- Q ! [a, b]: FldRat, RngIntElt, RngIntElt -> FldRatElt
- elt< Q | a, b >: FldRat, RngIntElt, RngIntElt -> FldRatElt
Given the rational field \({\mathbb{Q}}\), and integers \(a, b\) (with \(b\neq 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.
- One(Q): FldRat -> FldRatElt
- Identity(Q): FldRat -> FldRatElt
- Zero(Q): FldRat -> FldRatElt
- Representative(Q): FldRat -> FldRatElt
These generic functions (cf. Chapter Introduction to Rings) create \(1\), \(1\), \(0\), and \(0\) respectively, in the rational field \({\mathbb{Q}}\).
- 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.