6.9.2.1 pAdic Objects

class pAdic
The field of p-adic numbers of either finite or infinite precision. We represent p-adic numbers as product (p**r)*unit, where r is an integer or Infinity and unit is a p-adic unit known to some precision. If r=Infinity, then (p**r)*unit is the 0 element.

Binary operations on two elements of Qp reduce the precision of the unit part of the argument with larger precision to that of the one with lesser precision. This applies to all operations, including equality testing, so, e.g., the element O(p) is equal to every p-adic integer, since comparison will truncate the other p-adic integer to precision O(p).

pAdic( parent, x, [big_oh=None], [ordp=Infinity])

The parent is a p-adic field. The second argument, x, is anything that can be coerced to a p-adic number. The third argument big_oh is such that, e.g. $ 3^(-1)+1+2*3+O(3^2)$ has big_oh equal to 2.

Instances of class pAdic have the following methods (in addition to inherited methods and special methods):

big_oh,$  $ copy,$  $ denominator,$  $ is_unit,$  $ is_zero,$  $ lift,$  $ log,$  $ order,$  $ ordp,$  $ rational_reconstruction,$  $ unit_part,$  $ valuation

Further documentation:

log( )

Compute the p-adic logarithm of a unit in $ \mathbf{Z}_p$ .

The usual power series for log with values in the additive group of $ \mathbf{Q}_p$ only converges for 1-units (units congruent to 1 modulo p). However, there is a unique extension of log to a homomorphism defined on all the units. If u = a*v is a unit with v = 1 (mod p), then we define log(u) = log(v). This is the correct extension because the units U of Z_p splits as a product U = V x <w>, where V is the subgroup of 1-units and w is a (p-1)st root of unity. The <w> factor is torsion, so must go to 0 under any homomorphism to the torsion free group $ (\mathbf{Q}_p, +)$ .

Notes - What some other systems do: PARI: Seems to define log the same way as we do. MAGMA: Gives an error when unit is not a 1-unit.

Algorithm: Input: Some p-adic unit u. 1. Check that the input p-adic number is really a unit (i.e., valuation 0) 2. Let $ 1-x = u^{p-1}$ , which is a 1-unit. 3. Use the series expansion

$\displaystyle \log(1-x) = F(x) = -x - 1/2*x^2 - 1/3*x^3 - 1/4*x^4 - 1/5*x^5 - ...
$

to compute the logarithm log(u**(p-1)). Use enough terms so that terms added on are zero (to the default precision, if the input has infinite precision). 4. Then

$\displaystyle \log(u) = log(u^{p-1})/(p-1) = F(1-u^{p-1})/(p-1).$

Examples:

order( )

The order of this as an element of the multiplicative group. If the element is known to infinite precision, then it is truncated to the parent precision before the order is computed.

sage: K = Qp(13)
sage: a = K(-1)
sage: a.order()
2

We immediately know that 13 has infinite order, since it is 0 modulo 13.

sage: b = K(13)
sage: b.order()
Infinity

The following element has finite order modulo 5**2.

sage: c = 3 + 3*5 + 2*5**2 + O(5**3)
sage: c.order()
4

rational_reconstruction( )

Try to lift the p-adic number to the rationals using rational reconstruction, as follows: Suppose the p-adic number is $ p^{r}\cdot (u+O(p^n))$ , where u is a unit. Using rational reconstruction, try to find the unique rational number a/b such that a/b is congruent to u modulo $ p^n$ , and abs(a), abs(b) are both at most $ \sqrt{p/2}$ . If such $ a/b$ exists, return $ p^r \cdot (a/b)$ .

unit_part( )
The unit part of (p**r)*u, which is simply u.
sage: x = 9*(2+3+O(3**7))
sage: x.unit_part()
2 + 3 + O(3^7)

Instances of class pAdic also have the following special methods:

__add__,$  $ __cmp__,$  $ __div__,$  $ __invert__,$  $ __mod__,$  $ __mul__,$  $ __neg__,$  $ __pos__,$  $ __pow__,$  $ __repr__,$  $ __sub__,$  $ _integer_

See About this document... for information on suggesting changes.