Module: sage.rings.padic
We represent a
-adic number as a product
, where
is
an integer or
and
is a
-adic unit known to some
precision. If
, then
is the 0
element.
Binary operations on two elements of
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
is equal to every
-adic integer, since comparison will truncate the other
-adic
integer to precision
.
Author Log:
Class: pAdic
sage: a = 1 + 17 + 3*17^2 + O(17^3) sage: a 1 + 17 + 3*17^2 + O(17^3) sage: loads(a.dumps()) == a True
self, parent, x, [big_oh=False], [ordp=None], [construct=Infinity]) |
INPUT: parent -- a p-adic field. x -- anything that can be coerced to a p-adic number. big_oh -- is such that, e.g. 3^(-1) + 1 + 2 * 3 + (3^2) has big_oh equal to 2.
Functions: additive_order,
big_oh,
copy,
denominator,
is_unit,
is_zero,
lift,
log,
multiplicative_order,
ordp,
rational_reconstruction,
unit_part,
valuation
self) |
The additive order of self as an element of the additive group.
sage: K = Qp(11) sage: a = K(1); a 1 sage: a.additive_order() Infinity sage: b = zero(K); b 0 sage: b.additive_order() 1
self) |
Return the denominator of this p-adic number, which is an integer
that is a power of
.
sage: K = Qp(11); K.prec(10) sage: a = K(211/17); a 4 + 4*11 + 11^2 + 7*11^3 + 9*11^5 + 5*11^6 + 4*11^7 + 8*11^8 + 7*11^9 + O(11^10) sage: a.denominator() 1 sage: b = K(3211/11^2); b 10*11^-2 + 5*11^-1 + 4 + 2*11 + O(11^Infinity) sage: b.denominator() 121
self) |
sage: K = Qp(11) sage: a = K(2); a 2 + O(11^Infinity) sage: a.is_unit() True sage: K(121).is_unit() False sage: K(0).is_unit() False
self) |
sage: K = Qp(11) sage: a = K(2); a 2 + O(11^Infinity) sage: a.is_zero() False
sage: K = Qp(11) sage: K(0).is_zero() True
self) |
Return rational number with denominator only divisible by
that lifts this
-adic number, to the given precision.
sage: a = 4596/7^2 + O(7^4); a 4*7^-2 + 5*7^-1 + 2 + 6*7 + 7^2 + O(7^4) sage: a.lift() 4596/49
sage: K = Qp(19) sage: K.prec(5)
sage: a = K(-1); a 18 + 18*19 + 18*19^2 + 18*19^3 + 18*19^4 + O(19^Infinity) sage: a.lift() -1
sage: a = 4596/18 + O(7^4); a 1 + 6*7 + 2*7^2 + 5*7^3 + O(7^4) sage: a.lift() 40747250655980528766
self) |
Compute the p-adic logarithm of a unit in
.
The usual power series for log with values in the additive
group of
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
.
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
, which is a 1-unit.
3. Use the series expansion
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
sage: Q13 = Qp(13) sage: Q13.prec(10) sage: a = Q13(14); a 1 + 13 + O(13^Infinity) sage: a.log() 13 + 6*13^2 + 2*13^3 + 5*13^4 + 10*13^6 + 13^7 + 11*13^8 + 8*13^9 + O(13^10)
self) |
The multiplicative order of this as an element, if defined.
If the element is known to infinite precision, then it is truncated to the parent default precision before the order is computed.
sage: K = Qp(13) sage: a = K(-1) sage: a.multiplicative_order() 2
We immediately know that 13 has infinite order, since it is 0 modulo 13.
sage: b = K(13) sage: b.multiplicative_order() Infinity
The following element has finite multiplicative order modulo
:
sage: c = 3 + 3*5 + 2*5**2 + O(5**3) sage: c.multiplicative_order() 4
self) |
Return the
-adic valuation at this
-adic number, normalized
so that the valuation of
is
.
sage: K = Qp(11) sage: a = K(211/17); a 4 + 4*11 + 11^2 + 7*11^3 + 9*11^5 + 5*11^6 + 4*11^7 + 8*11^8 + 7*11^9 + 9*11^10 + 3*11^11 + 10*11^12 + 11^13 + 5*11^14 + 6*11^15 + 2*11^16 + 3*11^17 + 11^18 + 7*11^19 + O(11^20) sage: a.ordp() 0 sage: b = K(3211/11^2); b 10*11^-2 + 5*11^-1 + 4 + 2*11 + O(11^Infinity) sage: b.ordp() -2
self) |
Try to lift the p-adic number to the rationals using rational
reconstruction, as follows: Suppose the p-adic number is
, 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
, and abs(a),
abs(b) are both at most
. If such
exists,
return
.
sage: K = Qp(11); K.prec(10); K.print_prec(10) sage: a = K(-1); a 10 + 10*11 + 10*11^2 + 10*11^3 + 10*11^4 + 10*11^5 + 10*11^6 + 10*11^7 + 10*11^8 + 10*11^9 + O(11^Infinity) sage: a.rational_reconstruction() -1 sage: a = K(2); a 2 + O(11^Infinity) sage: a.rational_reconstruction() 2
self) |
Return the unit part of
, which is simply u.
sage: x = 9*(2+3+O(3**7)) sage: x.unit_part() 2 + 3 + O(3^7) sage: K = Qp(19) sage: K.prec(5) sage: a = K(2)/19; a 2*19^-1 + O(19^4) sage: a.unit_part() 2 + O(19^5)
self) |
Same as ordp.
Special Functions: __cmp__,
__invert__,
__mod__,
__neg__,
__pos__,
__pow__,
_add_,
_div_,
_integer_,
_mul_,
_pari_init_,
_repr_,
_sub_
self, other) |
First compare valuations, then compare normalized residue of unit part.
sage: K = Qp(19) sage: K.prec(5) sage: a = K(2); a 2 + O(19^Infinity) sage: b = K(3); b 3 + O(19^Infinity) sage: a < b True
self) |
sage: K = Qp(19) sage: K.prec(5) sage: a = K(20); a 1 + 19 + O(19^Infinity) sage: b = ~a # calls __invert__ sage: b 1 + 18*19 + 18*19^3 + O(19^5) sage: a*b 1 + O(19^5)
self, right) |
sage: K = Qp(19) sage: K.prec(5) sage: a = K(-1); a 18 + 18*19 + 18*19^2 + 18*19^3 + 18*19^4 + O(19^Infinity) sage: a^2 1 sage: a^3 18 + 18*19 + 18*19^2 + 18*19^3 + 18*19^4 + O(19^Infinity) sage: K(5)^30 11 + 14*19 + 19^2 + 7*19^3 + O(19^Infinity)
self, right) |
sage: K = Qp(11); K.prec(10); K.print_prec(5) sage: a = K(-1); a 10 + 10*11 + 10*11^2 + 10*11^3 + 10*11^4 + O(11^Infinity) sage: b = K(1); b 1 sage: a+b 0
self, right) |
sage: K = Qp(19) sage: K.prec(5) sage: a = K(2/19); a 2*19^-1 + O(19^Infinity) sage: b = K(3/19); b 3*19^-1 + O(19^Infinity) sage: a/b 7 + 6*19 + 6*19^2 + 6*19^3 + 6*19^4 + O(19^5)
self, right) |
sage: K = Qp(19) sage: K.prec(5) sage: (-1)*one(K) 18 + 18*19 + 18*19^2 + 18*19^3 + 18*19^4 + O(19^Infinity) sage: a = K(2/19); a 2*19^-1 + O(19^Infinity) sage: b = K(3/19); b 3*19^-1 + O(19^Infinity) sage: a*b 6*19^-2 + O(19^Infinity)
self) |
PARI representation of a p-adic is the same as in SAGE.
self, right) |
sage: K = Qp(19) sage: K.prec(5) sage: zero(K) - one(K) 18 + 18*19 + 18*19^2 + 18*19^3 + 18*19^4 + O(19^Infinity)
See About this document... for information on suggesting changes.