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

Element Constructions and Conversions

p-adic ring and field elements are implemented using a balanced mod representation. This allows negative elements to have infinite precision in an infinite precision ring and, if x is a small negative integer, allows it to be represented as x rather than p^m - - x where m is a precision.

Infinite precision elements are implemented using exact quotients. They are stored as numerator (may have valuation) and denominator (must have valuation zero). This means that two infinite precision elements can be divided and the result will still have infinite precision.

Subsections

Constructions

To simplify the creation of elements in a p-adic ring, various coercions are provided. The most obvious is to regard the integer ring or rational field as embedded into the p-adic ring or field. But there is a range of coercions available, including that of elements from the residue class field.

To create an element of a p-adic field not lying in the p-adic ring, constructors are provided that create an element of the ring and allow multiplication of this by the appropriate power of the prime.

For descriptions not given please refer to Section Constructions.

Zero(P) : RngLoc -> RngLocElt
Zero(P) : FldLoc -> FldLocElt
One(P) : RngLoc -> RngLocElt
One(P) : FldLoc -> FldLocElt
Random(P) : RngLoc -> RngLocElt
Representative(P) : RngLoc -> RngLocElt
Representative(P) : FldLoc -> FldLocElt
UniformizingElement(P) : RngLoc -> RngLocElt
P . 1 : RngLoc -> RngLocElt
UniformizingElement(P) : FldLoc -> FldLocElt
P . 1 : FldLoc -> FldLocElt
elt<P | u> : RngLoc, RngElt -> RngLocElt
P ! u : RngLoc, RngElt -> RngLocElt
elt<P | u> : FldLoc, RngElt -> FldLocElt
P ! u : FldLoc, RngElt -> FldLocElt
Given an element u, coerce it into the p-adic ring or field P. The resulting element will have as much precision as it can. The element u is allowed to be one of the following The elt-constructor is the (left) inverse (for ring elements) to the sequence constructor Eltseq described below.
elt<P | u, r> : RngLoc, RngElt, RngIntElt -> RngLocElt
elt<P | u, r> : RngLoc, [RngElt], RngIntElt -> RngLocElt
elt<P | u, r> : FldLoc, RngElt, RngIntElt -> FldLocElt
elt<P | u, r> : FldLoc, [RngElt], RngIntElt -> FldLocElt
Create an element of the p-adic ring or field P by coercing u into P and returning with it precision r. The list of possibilities for u above apply here.
elt<P | v, u> : RngLoc, RngIntElt, RngElt -> RngLocElt
elt<P | v, u> : RngLoc, RngIntElt, [RngElt] -> RngLocElt
elt<P | v, u> : FldLoc, RngIntElt, RngElt -> FldLocElt
elt<P | v, u> : FldLoc, RngIntElt, [RngElt] -> FldLocElt
Create an element of the p-adic ring or field P by coercing u into P and multiplying by the v-th power of the uniformizing element. This is equivalent to P.1^v * elt< P | u >. If u is an integer this will be taken to be the elt<P | u, r> constructor.
elt<P | v, u, r> : RngLoc, RngIntElt, RngElt, RngIntElt -> RngLocElt
elt<P | v, u, r> : RngLoc, RngIntElt, [RngElt], RngIntElt -> RngLocElt
elt<P | v, u, r> : FldLoc, RngIntElt, RngElt, RngIntElt -> FldLocElt
elt<P | v, u, r> : FldLoc, RngIntElt, [RngElt], RngIntElt -> FldLocElt
Create an element of the p-adic ring or field P by coercing u into P, multiplying by the v-th power of the uniformizing element and returning it with precision r. This is equivalent to elt<P | elt<P | v, u>, r>.
BigO(x) : RngLocElt -> RngLocElt
O(x) : RngLocElt -> RngLocElt
For an element x of valuation v, create an element of valuation v and relative precision 0. For rings this is the zero element in the quotient P / (P.1^v).

Example RngPad_eltcons (H42E4)

Here we illustrate the usage of element constructors for p-adic fields and imprecise zeros.

> Qp<q> := pAdicField(3);
> elt<Qp | 64>;
64
> elt<Qp | -3, 64, 10>;
64*q^-3 + O(q^7)
> elt<Qp | 2, 3/4, 8>;
-1640*q^3 + O(q^11)
> elt<Qp | 2, 3/4>;   
q^3/4
> 4*$1;
q^3
> Precision($1);
Infinity
> BigO(Qp!139856304^4); 
O(q^4)
> Precision($1);
0
> O(Qp!0);
0
> O(Qp!1);
O(1)
> Valuation($2);
Infinity

Sequence Conversions

The two functions in this section differ in the universe of the sequence and the remembrance of denominators. For an element of a p-adic field, the valuation needs to be remembered to allow it to be reconstructed from the sequence with the elt-constructor described in the previous section.

ElementToSequence(x) : RngLocElt -> [ RngIntElt ]
ElementToSequence(x) : FldLocElt -> [ RngIntElt ]
Eltseq(x) : RngLocElt -> [ RngIntElt ]
Eltseq(x) : FldLocElt -> [ RngIntElt ]
The returned sequence s is the p-adic expansion of x, i.e. such that x = sum_(i=1)^(#s) s[i] * p^(i - 1 + v) where v is the valuation of a p-adic field element and zero for a ring element. The entries of s are integers in the range [ - Floor((p - 1)/2) ... Ceiling((p - 1)/2) ]. The denominator of x is discarded.

This is the (right) inverse (for ring elements) to the !-operator, i.e., P ! Eltseq(x) = x.

Coefficients(x) : RngLocElt -> [ RngLocElt ]
Coefficients(x) : FldLocElt -> [ FldLocElt ]
Returns a sequence of p-adic elements x_i identical to their coercion into the residue class field such that x = sum_(i = 1) x_i * p^(i - 1 + v) where v is the valuation of a p-adic field element and zero for a ring element. These are the coefficients seen when SeriesPrinting is true for the parent of x. This sequence cannot be coerced back into the p-adic ring or field. Coefficients remembers the denominator of x.
Coefficient(x, i) : RngLocElt, RngIntElt -> RngLocElt
Coefficient(x, i) : FldLocElt, RngIntElt -> FldLocElt
Returns the coefficient of the ith power of the prime. This coefficient will be the i + 1 - vth entry in the sequence returned by Coefficients where v is the valuation of x if x is a field element and zero if x is a ring element. The denominator of x is remembered.

Example RngPad_gal-desc (H42E5)

From the functions introduced above it is possible to create elements of a p-adic ring Zp and a p-adic field Qp and look at their coefficients.

> Zp<p> := pAdicRing(5);
> Qp<q> := pAdicField(3);
> y := Expand(Zp!Random(ChangePrecision(Zp, 50)));
> y;
12579395098865826384604888452169139
> x := elt<FieldOfFractions(Zp) | -3, y, 40>;
> x;
1074651119069636779321309764*5^-3 + O(5^37)
> Precision(Zp);
Infinity
> Zp![0, 3, 3, 1, 2, 0, 3, 4, 1, 2, 4];
43720215
> elt<Qp | 5, [0, 2, 1, 2, 1, 0, 2]>;
536*q^6
> Coefficients($1);
[ -1, -1, 0, -1, 1, -1, 1 ]
> Coefficient(y, 4);
1
> Coefficients(y);
[ -1, -2, 1, -2, 1, -1, -1, -2, -2, -2, -2, 1, -2, 0, 0, -2, 2, -1, 1, -2, 1, 
-1, 2, 1, -1, 0, -2, 2, 1, -1, -2, 0, 1, 1, 1, -1, -1, 0, -2, 1, -1, -1, 0, 0, 
-2, -2, -1, -2, -1, 1 ]
> Eltseq(y);
[ -1, -2, 1, -2, 1, -1, -1, -2, -2, -2, -2, 1, -2, 0, 0, -2, 2, -1, 1, -2, 1, 
-1, 2, 1, -1, 0, -2, 2, 1, -1, -2, 0, 1, 1, 1, -1, -1, 0, -2, 1, -1, -1, 0, 0, 
-2, -2, -1, -2, -1, 1 ]
> Universe($2);
5-adic Ring
> Universe($2);
Integer Ring
> Coefficients(y)[4 + 1 - Valuation(y)];
1

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