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

Operations on Elements

For descriptions not given please refer to Section Operations on Elements.

Subsections

Arithmetic

For p-adic ring elements the usual operations for ring elements are available. The quotient of two elements can be computed when the result lies in the ring (i.e. the valuation of the dividend is not smaller than that of the divisor). The precision of the result is reduced by the valuation of the divisor. The result of an operation with elements of reduced precision will have as much precision as possible. For addition and subtraction this is the minimum of the precisions of the two elements, for multiplication it is the minimum of v_1 + pr_2 and v_2 + pr_1, where v_i and pr_i are the valuations and precisions of the two elements, respectively.

For p-adic field elements the operations are performed with the maximum precision possible. For multiplication and division this is the minimum of the (relative) precisions of the two elements. For addition and subtraction of elements x and y with valuations v_x and v_y and precisions pr_x and pr_y the precision of x +- y is min(v_x + pr_x, v_y + pr_y) - val(x +- y), which may even be 0.

The result of these operations on two infinite precision elements will be an element with infinite precision.

- x : RngLocElt -> RngLocElt
- x : FldLocElt -> FldLocElt
x + y : RngLocElt, RngLocElt -> RngLocElt
x + y : FldLocElt, FldLocElt -> FldLocElt
x - y : RngLocElt, RngLocElt -> RngLocElt
x - y : FldLocElt, FldLocElt -> FldLocElt
x * y : RngLocElt, RngLocElt -> RngLocElt
x * y : FldLocElt, FldLocElt -> FldLocElt
x ^ k : RngLocElt, RngIntElt -> RngLocElt
x ^ k : FldLocElt, RngIntElt -> FldLocElt
x div y : RngLocElt, RngLocElt -> RngLocElt
x / y : RngLocElt, RngLocElt -> RngLocElt
x / y : FldLocElt, FldLocElt -> FldLocElt

Example RngPad_Division (H42E6)

Division of non-units is possible in the ring if the result lies in the ring. In that case the result has reduced precision.

> Zp<p> := pAdicRing(2, 20);
> c := Random(Zp);
> c := c/p^Valuation(c);
> 1 / c;
> 1/c;
500047
> c*1/c;
1 + O(p^18)

> 1 / (p*c); >> 1 / (p*c); ^ Runtime error in '/': Division is not exact > p / (p*c); -24241 + O(p^19)
In an infinite precision ring quotients appear a little differently.

> Zp<p> := pAdicRing(2);
> c := Expand(Zp!c);
> c;
-76369
> 1/c;
-1/76369

Equality and Membership

It is possible to test whether two p-adic ring or field elements are equal and whether any element is in a p-adic ring or field. The existence of elements with reduced precision may cause results which are not completely intuitive at first sight.

Two elements of a p-adic ring or field are only regarded as equal, if their valuations, precisions and digits are identical. Thus, elements of reduced precision which coincide in all known digits can still be regarded as the same, even though the missing digits are unknown rather than 0.

x eq y : RngLocElt, RngLocElt -> BoolElt
x eq y : FldLocElt, FldLocElt -> BoolElt
x ne y : RngLocElt, RngLocElt -> BoolElt
x ne y : FldLocElt, FldLocElt -> BoolElt
x in P : ., RngLoc -> BoolElt
x in P : ., FldLoc -> BoolElt
x notin P : ., RngLoc -> BoolElt
x notin P : ., FldLoc -> BoolElt

Example RngPad_unram-ext (H42E7)

We demonstrate how an unramified extension can be constructed given a degree. The idea is to interpret the minimal polynomial of a primitive element in the residue class field as a polynomial over Z_p. The quotient of Z_p[x] by the ideal generated by this polynomial is isomorphic to the unramified extension and a := /line(x) is a first approximation for a (p^f - 1)st root of unity. This is improved by iterating a |-> a^(p^f) until this remains fixed.

> p := 2;
> f := 5;
> Zp := pAdicRing(p, 25);
> R<x> := PolynomialRing(Zp);
> g := R ! MinimalPolynomial( GF(p,f).1 );
> Q<r> := quo< R | g >;
> a := [ r, r^(p^f) ];
> while a[#a] ne a[#a-1] do
>     print a[#a];
>     Append( a, a[#a]^(p^f));
> end while;
34*r^4 - 44*r^3 + 58*r^2 - 23*r + 36
12522914*r^4 + 12522004*r^3 - 12174790*r^2 - 8200343*r - 10407260
8242594*r^4 + 12409364*r^3 + 5143098*r^2 + 15781737*r - 3636572
5490082*r^4 + 8804884*r^3 - 11109830*r^2 + 11456361*r + 11698852
-15481438*r^4 - 5875180*r^3 + 5667386*r^2 + 7262057*r - 884060
> [ Minimum([ Valuation(c) : c in Eltseq(a[i] - a[i-1]) ]) : i in [2..#a-1] ];
[ 1, 6, 11, 16, 21 ]
The last command demonstrates the convergence of the process. The polynomial defining the unramified extension could now be obtained as the minimal polynomial of the fixed element.

Properties

p-adic ring and field elements can be tested for certain properties. There is only one zero, one and minus one in each ring or field.

IsZero(x) : RngLocElt -> BoolElt
IsZero(x) : FldLocElt -> BoolElt
IsOne(x) : RngLocElt -> BoolElt
IsOne(x) : FldLocElt -> BoolElt
IsMinusOne(x) : RngLocElt -> BoolElt
IsMinusOne(x) : FldLocElt -> BoolElt
IsUnit(x) : RngLocElt -> BoolElt
IsUnit(x) : FldLocElt -> BoolElt
IsIntegral(x) : RngLocElt -> BoolElt
IsIntegral(x) : FldLocElt -> BoolElt

Precision and Valuation

The parent of a p-adic element can be retrieved, its precision accessed and changed, its valuation computed and its denominator returned. Elements of reduced precision can be turned into elements with full precision by replacing unknowns with zeros in the p-adic expansion.

Parent(x) : RngLocElt -> RngLoc
Parent(x) : FldLocElt -> FldLoc
Precision(x) : RngLocElt -> RngIntElt
Precision(x) : FldLocElt -> RngIntElt
AbsolutePrecision(x) : RngLocElt -> RngIntElt
AbsolutePrecision(x) : FldLocElt -> RngIntElt
RelativePrecision(x) : RngLocElt -> RngIntElt
RelativePrecision(x) : FldLocElt -> RngIntElt
ChangePrecision(x, m) : RngLocElt, RngIntElt -> RngLocElt
ChangePrecision(~x, m) : RngLocElt, RngIntElt -> RngLocElt
ChangePrecision(x, m) : FldLocElt, RngIntElt -> FldLocElt
ChangePrecision(~x, m) : FldLocElt, RngIntElt -> FldLocElt
Expand(x) : RngLocElt -> RngLocElt
Expand(x) : FldLocElt -> FldLocElt
Valuation(x) : RngLocElt -> RngIntElt
Valuation(x) : FldLocElt -> RngIntElt
Denominator(x) : RngLocElt -> RngIntElt
Denominator(x) : FldLocElt -> RngIntElt

Example RngPad_ofe (H42E8)

The uses and properties of Relative and Absolute Precision for field elements are illustrated here as well as the results of Expand.

> Qp<q> := pAdicField(11);
> x := q + q^7;
> x;
1771562*q
> AbsolutePrecision(x);
Infinity
> RelativePrecision(x);
Infinity
> AbsolutePrecision(x + O(q^10));
10
> RelativePrecision(x + O(q^10));
9
> Expand(x + O(q^5)) eq x;
false
> Expand(x + O(q^5));     
q
> x;
1771562*q
> Valuation(x);
1
> Denominator(x);
1
> Denominator(x/9);
9
> Denominator(x/99);
9
> Valuation(x/99);  
0
> ChangePrecision(x, 20) eq (x + O(q^(20 + Valuation(x))));
true
The last two lines show that changing the precision of an element is equivalent to adding imprecision to the element effectively cancelling off all terms beyond that of (relative) valuation 20.

Logarithms and Exponentials

Logarithms and exponentials can also be calculated for certain elements.

Log(x) : RngLocElt -> RngLocElt
Log(x) : FldLocElt -> FldLocElt
The logarithm of the element x. Note that the power series of the logarithm function only converges if the valuation of x - 1 is positive. For ring elements x, the answer lies in the ring (and not its field of fractions) only if the valuation of x - 1 is greater than 0.

The rate of convergence of Log is dependent on the valuation of x - 1. The greater the valuation the faster the convergence, as is illustrated in the example below.

If the precision of x is infinite then the result is returned to the default precision of the ring or field.

Exp(x) : RngLocElt -> RngLocElt
Exp(x) : FldLocElt -> FldLocElt
The exponential of the p-adic element x. Note that the power series of the exponential function only converges if the valuation of x is strictly larger than 1/(p - 1).

If the precision of x is infinite then the result is returned to the default precision of the ring or field.


Example RngPad_log (H42E9)

This example illustrates the relative timings of the Log function and the Exp function for rings and fields and for various valuations of x - 1 or x as appropriate.

> Qp<q> := pAdicField(13);
> Zp<p> := Integers(Qp);
> x := 1 + p;
> time Log(x);
1499288193969767389565 + O(p^20)
Time: 0.050
> x := 1 + p^5;
> time Log(x); 
3167511024375542395421 + O(p^20)
Time: 0.010
> x := 1 + q;
> time Log(x);
115329861074597491505*q + O(q^20)
Time: 0.049
> x := 1 + q^6;
> time Log(x); 
663995423577305*q^6 + O(q^20)
Time: 0.010
> x := p^2; 
> time Exp(x);
7844051926694268462087 + O(p^20)
Time: 0.010
> x := p^10;  
> time Exp(x);
137858491850 + O(p^20)
Time: 0.000
> x := q;
> time Exp(x);
2019541981652074319142 + O(q^20)
Time: 0.010
> x := q^20;
> time Exp(x);
1 + O(q^20)
Time: 0.000
> Qp`DefaultPrecision := 50;
> time Exp(x);              
-24896461148775759576814825044801829714416151043291269522 + O(q^50)
Time: 0.000

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