[Next] [Prev] [_____] [Left] [Up] [Index] [Root]
Element Operations

Element Operations

Subsections

Parent and Category

Parent(r) : FldRatElt -> FldRat
Category(r) : FldRatElt -> Cat

Arithmetic Operators

+ a : FldRatElt -> FldRatElt
- a : FldRatElt -> FldRatElt
a + b : FldRatElt, FldRatElt -> FldRatElt
a - b : FldRatElt, FldRatElt -> FldRatElt
a * b : FldRatElt, FldRatElt -> FldRatElt
a ^ k : FldRatElt, RngIntElt -> FldRatElt
a / b : FldRatElt, FldRatElt -> FldRatElt
a +:= b : FldRatElt, FldRatElt -> FldRatElt
a -:= b : FldRatElt, FldRatElt -> FldRatElt
a *:= b : FldRatElt, FldRatElt -> FldRatElt
a /:= b : FldRatElt, FldRatElt -> FldRatElt
a ^:= k : FldRatElt, RngIntElt -> FldRatElt

Numerator and Denominator

Numerator(q) : FldRatElt -> RngIntElt
The (integer) numerator of the rational number q in reduced form.
Denominator(q) : FldRatElt -> RngIntElt
The (integer) denominator of the rational number q in reduced form. This will always be a positive integer.

Example FldRat_numerator (H26E3)

Rational numbers are always immediately put in reduced form, that is, the greatest common divisor of numerator and denominator is taken out, and the denominator will be positive.

> Numerator(10/-4);
-5
> Denominator(10/-4);  
2

Equality and Membership

a eq b : FldRatElt, FldRatElt -> BoolElt
a ne b : FldRatElt, FldRatElt -> BoolElt
a in R : FldRatElt, Rng -> BoolElt
a notin R : FldRatElt, Rng -> BoolElt

Predicates on Ring Elements

IsZero(a) : FldRatElt -> BoolElt
IsOne(a) : FldRatElt -> BoolElt
IsMinusOne(a) : FldRatElt -> BoolElt
IsNilpotent(a) : FldRatElt -> BoolElt
IsIdempotent(a) : FldRatElt -> BoolElt
IsUnit(a) : FldRatElt -> BoolElt
IsZeroDivisor(a) : FldRatElt -> BoolElt
IsRegular(a) : FldRatElt -> BoolElt
IsIrreducible(a) : FldRatElt -> BoolElt
IsPrime(a) : FldRatElt -> BoolElt
IsIntegral(q) : FldRatElt -> BoolElt
Returns true if the rational number q is an element of the ring of integers, false otherwise.

Comparison

a gt b : FldRatElt, FldRatElt -> BoolElt
a ge b : FldRatElt, FldRatElt -> BoolElt
a lt b : FldRatElt, FldRatElt -> BoolElt
a le b : FldRatElt, FldRatElt -> BoolElt
Maximum(a, b) : FldRatElt, FldRatElt -> FldRatElt
Maximum(Q) : [FldRatElt] -> FldRatElt
Minimum(a, b) : FldRatElt, FldRatElt -> FldRatElt
Minimum(Q) : [FldRatElt] -> FldRatElt

Conjugates, Norm and Trace

ComplexConjugate(q) : FldRatElt -> FldRatElt
The complex conjugate of q, which will be the rational number q itself.
Conjugate(q) : FldRatElt -> FldRatElt
The conjugate of q, which will be the rational number q itself.
Norm(q) : FldRatElt -> FldRatElt
The norm (in Q) of q, which will be the rational number q itself.
Trace(q) : FldRatElt -> FldRatElt
The trace (in Q) of q, which will be the rational number q itself.
MinimalPolynomial(q) : FldRatElt -> RngUPolElt
Returns the minimal polynomial of the rational number q, which is the monic linear polynomial with constant coefficient q in a univariate polynomial ring R over the rational field. (If R has not been created before with a name for its indeterminate, $.1-q will be returned.)

Absolute Value and Sign

AbsoluteValue(q) : FldRatElt -> FldRatElt
Abs(q) : FldRatElt -> FldRatElt
The absolute value | q| of a rational number q.
Sign(q) : FldRatElt -> RngIntElt
Returns the sign of the rational number q, which is one of the integers -1, 0, 1, corresponding to the cases q<0, q=0, and q>0.

Rounding and Truncating

Ceiling(q) : FldRatElt -> RngIntElt
The ceiling of the rational number q, that is, the least integer greater than or equal to q.
Floor(q) : FldRatElt -> RngIntElt
The floor of the rational number q, that is, the largest integer less than or equal to q.
Round(q) : FldRatElt -> RngIntElt
This function returns the integer value of the rational number q rounded to the nearest integer. In case of a tie, rounding is done upwards (that is, i + (1/2) is rounded to i + 1, for integers i).
Truncate(q) : FldRatElt -> RngIntElt
This function returns the integer truncation of the rational number q, that is the integral part of q. Thus the effect is that of rounding towards 0.

Rational Reconstruction

Under certain circumstances it is useful to have a partial inverse of the function psi _m:Q -> Z/mZ of taking residues modulo m (where the obvious value of psi _m is only defined for rational numbers with denominator in smallest terms coprime to m); that partial function is sometimes referred to as `rational reconstruction'. For s in Z/mZ the value of psi ^(-1)(s) is the rational number r for which psi _m(r)=s and, in addition, both numerator and denominator of r are bounded by sqrt(m/2); such r does not always exist, but if r exists it is unique.

RationalReconstruction(s) : RngResElt -> BoolElt, FldRatElt
RationalReconstruction(s) : FldFinElt -> BoolElt, FldRatElt
Given an element s of a ring S of m elements, return a Boolean flag indicating whether or not a rational number r exists such that for the representation r=n/d in minimal terms it holds that n.d^(-1) = s mod m, and both | n| and d are bounded by sqrt(m/2). If the flag is true, the element r is also returned. The ring S is allowed to be a residue class ring Integers(m) or a finite field of prime cardinality p=m: FiniteField(p).

In addition, s is allowed to be a matrix over a prime finite field, in which case the existence (and, if possible, value) of a rational reconstruction of the matrix is determined.

Valuation

Valuation(x, p) : FldRatElt, RngIntElt -> RngIntElt, FldRatElt
The valuation v of the rational number x at the prime p. This is the difference of the valuations of the numerator and denominator of x. The optional second return value is the rational u such that x = p^v u.
[Next] [Prev] [_____] [Left] [Up] [Index] [Root]