For local ring elements the usual operations 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 v1 + k2 and v2 + k1, where vi and ki are the valuations and precisions of the two elements, respectively.
For local 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 vx and vy and precisions kx and ky the precision of x ∓ y is min(vx + kx, vy + ky) - vp(x ∓ y), which may even be 0.
The negative of the element x.
The sum of the elements x and y.
The difference of the elements x and y.
The product of the elements x and y.
The k-th power of the element x. If k has valuation (when coerced) and x has precision less than that of its parent ring, the power xk will have more precision than x.
The quotient of the elements x and y. For elements of a local ring, this results in an error if the valuation of x is smaller than that of y.
Mutation operation: replace the element x by its quotient upon division by y. For elements of a local ring, this results in an error if the valuation of x is smaller than that of y.
The quotient of the elements x and y. For elements of a local ring, the result will be returned in its field of fractions.
Return true if x can be exactly divided by y; in this case also return the quotient.
> R := pAdicRing(2); > pi := UniformizingElement(R); > pi; 2 + O(2^20) > 1 / pi; 2^-1 + O(2^18) > Parent($1); 2-adic field > 1 div pi; >> 1 div pi; ^ Runtime error in 'div': Division is not exact > IsExactlyDivisible(1, pi); false > IsExactlyDivisible(pi^2, pi); true 2 + O(2^20)
It is possible to test whether two local ring or field elements are equal only in quotient rings. Equality testing in free precision rings is disabled, as there are several reasonable definitions of equality in an imprecise ring.
Given local ring or field elements x and y, return true if and only if x and y are identical in value. This operator is only defined in fixed precision rings.
Given local ring or field elements x and y, return true if and only if x and y are not identical in value. This operator is only defined in fixed precision rings.
Return true if and only if x lies in the local ring or field L.
Return true if and only if x does not lie in the local ring or field L.
> 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 statement demonstrates the convergence of the process. The polynomial defining the unramified extension could now easily be obtained as the minimal polynomial of the fixed element.
> U := ext<Zp | f>; > MinimalPolynomial(U ! Eltseq(a[#a])); x^5 - 13205240*x^4 - 3159900*x^3 - 13778593*x^2 + 9730498*x - 1
Local ring and field elements can be tested for certain properties. However, note that in free precision rings and fields, exact zero, one, and minus one elements do not exist, only approximations to such elements --- in these cases, the predicates will always return false.
Given an element x of a local ring or field, return true if and only if x is the zero element of its parent ring or field.
Given an element x of a local ring or field, return true if and only if x is the one element of its parent ring or field.Note that this is always false for an element of a ring or field of unbounded precision.
Given an element x of a local ring or field, return true if and only if x is the minus one element of its parent ring or field.Note that this is always false for an element of a ring or field of unbounded precision.
Given an element x of a local ring or field, return true if and only if x is a unit, that is, x has valuation 0.
Given an element x of a local ring or field, return true if and only if x has non-negative valuation.
Note that the precision of an element may be modified.
Return the parent local ring or field of the element x.
For a local ring element x, returns the precision to which it is known; for a local field element x, returns the precision to which its unit part is known.
Returns the precision of a local ring or field element x.
Returns the difference between the absolute precision and the valuation of the local ring or field element x.
Given a local ring or field element or polynomial over a local ring or field x and a non-negative single precision integer k, change the precision of x to k. If k is smaller than the precision of x, x is truncated; if k is larger, then an element y is returned such that v(x - y) ≥k. Note that the precision of an element cannot be changed to be greater than its parent. Any attempt to do so will result in the element gaining the precision of its parent.
Change the precision of the local ring or field element x to be the maximum precision allowed by its parent. This results in an error if x is an element of an unbounded free precision ring.
Return the valuation of the local ring or field element x. This is always bounded by the absolute precision of the element.
> R<x> := PolynomialRing(Integers()); > K<d> := ext<ext<pAdicField(5, 100) | 2> | x^2 + 5>; > x := d + d^7; > x; -d*124 + O(d^200) > AbsolutePrecision(x); 200 > RelativePrecision(x); 199 > RelativePrecision(x + O(d^10)); 9 > AbsolutePrecision(x + O(d^10)); 10 > RelativePrecision(ChangePrecision(x, 19)); 19 > RelativePrecision(ChangePrecision(x, 10)); 10 > AbsolutePrecision(ChangePrecision(x, 10)); 11 > Expand(ChangePrecision(x, 10)); d*3001 + O(d^201) > Valuation(x); 1 > ChangePrecision(x, 20) - (x + O(d^21)); O(d^21)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.
> IsOne(pAdicField(7)!1); false > IsMinusOne(pAdicField(7)!-1); false > IsZero(pAdicField(7)!0); true
The logarithm of the local ring or field element x, returned to the precision of 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 or equal to the ramification degree of the ring divided by the prime.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.
The exponential of the local ring or field element x, returned to the precision of x. Note that the power series of the exponential function only converges if the valuation of x is strictly larger than e/(p - 1), where e is the ramification degree of the parent ring of x.
> K := ext<pAdicField(3, 20) | x^3 + x^2 + x + 2>; > K<d> := ext<K | x^3 + 3*x^2 + 3*x + 3>; > L<b> := IntegerRing(K); > x := 1 + b; > time Log(x); Time: 0.070 > x := 1 + b^5; > time Log(x); 874050819*b^2 + 1624571442*b - 914550768 Time: 0.010 > RelativePrecision(Exp(Log(x)) - x); 0 > x := b^2; > time Exp(x); 1418565628*b^2 + 1334033745*b + 905945461 Time: 0.170 > RelativePrecision(Log(Exp(x)) - x); 0 > x := b^6; > time Exp(x); 1700312013*b^2 - 72781965*b + 1129064707 Time: 0.020 > RelativePrecision(Log(Exp(x)) - x); 0
Given a local ring or field element x, return the norm of x over the base ring of its parent.
Given a local ring or field element x, return the norm of x over the local ring or field R. The ring R must be a subring of the parent of x.
Given a local ring or field element x, return the trace of x over the base ring of its parent. The trace is the product of all conjugates of x.
Given a local ring or field element x, return the trace of x over the local ring or field R. The ring R must be a subring of the parent of x. The trace is the sum of all conjugates of x.
Given a local ring or field element x, return the minimal polynomial of x over the base ring of its parent.
Given a local ring or field element x, return the minimal polynomial of x over the local ring or field R. The ring R must be a subring of the parent of x.
Given a local ring element x, return the characteristic polynomial of x over the base ring of its parent.
Given a local ring or field element x, return the characteristic polynomial of x over the local ring or field R. The ring R must be a subring of the parent of x.
Given a local ring or field element x, return the image of x under the Frobenius automorphism composed with itself i times, that is, a |-> a(pi) where a is a pf - 1st root of unity of the parent of x.
> d := 50; > FF := GF(2^d); > E := EllipticCurve([FF | 1, 0, 0, 0, Random(FF)]); > assert Degree(sub<BaseRing(E) | jInvariant(E)>) gt 2; > > n := (d + 1) div 2 + 3; > R := ext<pAdicRing(2) | d>; > R`DefaultPrecision := n; > > a6 := elt<R | jInvariant(E)^-1, 1>; > lambda := 1 + 8 * a6; > > for k in [4..n] do > ChangePrecision(~lambda, k + 2); > lambda := (1 + lambda) * InverseSqrt(lambda) div 2; > end for; > lambda := 2 * lambda div (1 + lambda); > Exp(Trace(Log(lambda))); 32196193 + O(2^26) > Trace(E) mod 2^26; 32196193
Return the euclidean norm of the element x of a fixed precision local ring.
By taking small linear combinations of powers of a p-adic number, one can attempt to determine if it satisfies an algebraic relation.
Given a p-adic number over Qp, return a degree n relation for its powers. If this has small coefficients compared to the precision, then the element is likely an approximation to an algebraic number satisfying the return polynomial.
Another important operation is the determination of the canonical Teichmüller lift of an element u in the residue field of a p-adic ring. By definition this is the unique root of unity of order prime to p which reduces to u modulo the maximal ideal.
For a fixed precision quotient ring R of the p-adics or an unramified extension and a finite field element u, the function attempts to coerce u into the residue class field of R and then computes and returns its Teichmüller lift to R. This uses a fast iterative lifting method of Harley described in Chapter 12 of [C+05]. For unramified extensions this works most efficiently with Cyclotomic or Gaussian Normal bases since it uses the Frobenius operation.