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

Creation Functions

Subsections

Creation of Structures

The ring of integers is automatically created when Magma is first loaded. The ring may be formally created (and assigned to a variable) using the function IntegerRing(). Subrings of Z will always de ideals; see the section on ideals for details.

IntegerRing() : Null -> RngInt
Integers() : Null -> RngInt
IntegerRing(Q) : Fldrat -> RngInt
Create the ring of integers Z. Analogous to the creation of the ring of integers of any number field, there is a version of IntegerRing that creates Z as the ring of integers of Q.

Creation of Elements

Since the ring of integers is around when Magma is started up, literally typed integers will be regarded as elements of the ring of integers.

One(Z) : RngInt -> RngIntElt
Identity(Z) : RngInt -> RngIntElt
Zero(Z) : RngInt -> RngIntElt
Representative(Z) : RngInt -> RngIntElt
These generic functions create 1, 1, 0, and 0 respectively, in the integer ring Z.
a_1a_2...a_r : RngIntElt, ..., RngIntElt -> RngIntElt
Given a succession of decimal digits a_1, ..., a_r, create the corresponding integer. Leading zeros will be ignored.
elt< Z | a_1a_2...a_r > : RngInt, RngIntElt -> RngIntElt
Given a succession of decimal digits a_1, ..., a_r, create the corresponding integer as an element of Z.
Z ! a : RngInt, RngElt -> RngIntElt
Coerce the ring element a into the ring of integers Z; here a is allowed to be a an element of the ring of integers modulo m (in which case the result r satisfies 0 <= r < m), or an element of a finite field (in which case the result r satisfies 0 <= r < p if a is in the prime field, of characteristic p, and an error otherwise), or an element of the integers, rationals, a quadratic field, a cyclotomic field or a number field (in which cases the result is the obvious integer if a is integral and an error otherwise).

Example RngInt_Integers (H24E2)

> Z := IntegerRing();
> n := 1234567890;
> n in Z;
true
> m := elt< Z | 1234567890 >;
> m eq n;
true
> l := Z ! elt< QuadraticField(3) | 1234567890, 0>;
> l;
1234567890

Element Conversions

FactorizationToInteger(s) : [ <RngIntElt, RngIntElt> ] -> RngIntElt
FactorisationToInteger(s) : [ <RngIntElt, RngIntElt> ] -> RngIntElt
Facint(s) : [ <RngIntElt, RngIntElt> ] -> RngIntElt
Given a sequence of two-element tuples s=[ <p_1, k_1>, ..., <p_r, k_r> ] containing pairs of integers <p_i, k_i>, 1 <= i <= r, with k_i non-negative, this function returns the integer p_1^(k_1) ... p_r^(k_r). It is normally used for converting a factorization sequence to the corresponding integer.
IntegerToSequence(n, b) : RngIntElt, RngIntElt -> [RngIntElt]
Intseq(n, b) : RngIntElt, RngIntElt -> [RngIntElt]
Given a non-negative integer n and a positive integer b >= 2, return the unique base b representation of n in the form of a sequence Q. That is, if n = a_0b^0 + a_1b^1 + ... + a_(k - 1)b^(k - 1) with 0 <= a_i<b and a_(k - 1)> 0, then Q = [ a_0, a_1, ..., a_(k - 1) ]. (If n=0, then Q=[ ].)
SequenceToInteger(s, b) : [RngIntElt], RngIntElt -> RngIntElt
Seqint(s, b) : [RngIntElt], RngIntElt -> RngIntElt
Given a positive integer b >= 2 and a sequence Q = [ a_0, ..., a_(k - 1) ] of non-negative integers such that 0 <= a_i < b, return the integer n = a_0b^0 + a_1b^1 + ... + a_(k - 1)b^(k - 1). (If Q is the empty sequence, zero is returned.) This is the inverse operation of the base b representation.
IntegerToString(n) : RngIntElt -> ModStgElt
Create the string consisting of the decimal digits of the integer n (preceded by the minus sign if n is negative).
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]