Elements of -Adic Rings with Absolute Precision Cap
AUTHORS:
Unpickles a capped absolute element.
EXAMPLES:
sage: from sage.rings.padics.padic_capped_absolute_element import make_pAdicCappedAbsoluteElement
sage: R = ZpCA(5)
sage: a = make_pAdicCappedAbsoluteElement(R, 17*25, 5); a
2*5^2 + 3*5^3 + O(5^5)
Returns a copy of self.
EXAMPLES:
sage: a = ZpCA(5,6)(17); b = copy(a)
sage: a == b
True
sage: a is b
False
Returns the multiplicative inverse of self.
EXAMPLES:
sage: R = ZpCA(17)
sage: ~R(-1) == R(-1)
True
sage: ~R(5) * 5
1 + O(17^20)
sage: ~R(5)
7 + 3*17 + 10*17^2 + 13*17^3 + 6*17^4 + 3*17^5 + 10*17^6 + 13*17^7 + 6*17^8 + 3*17^9 + 10*17^10 + 13*17^11 + 6*17^12 + 3*17^13 + 10*17^14 + 13*17^15 + 6*17^16 + 3*17^17 + 10*17^18 + 13*17^19 + O(17^20)
Multiplies self by p^shift.
If shift < -self.ordp(), digits will be truncated. See __rshift__ for details.
EXAMPLES:
We create a capped absolute ring:
sage: R = Zp(5, 20, 'capped-abs'); a = R(1000); a
3*5^3 + 5^4 + O(5^20)
Shifting to the right is the same as dividing by a power of
the uniformizer of the
-adic ring.:
sage: a >> 1
3*5^2 + 5^3 + O(5^19)
Shifting to the left is the same as multiplying by a power of
:
sage: a << 2
3*5^5 + 5^6 + O(5^20)
sage: a*5^2
3*5^5 + 5^6 + O(5^20)
Shifting by a negative integer to the left is the same as right shifting by the absolute value:
sage: a << -3
3 + 5 + O(5^17)
sage: a >> 3
3 + 5 + O(5^17)
Pickling.
TESTS:
sage: a = ZpCA(5)(-3)
sage: type(a)
<type 'sage.rings.padics.padic_capped_absolute_element.pAdicCappedAbsoluteElement'>
sage: loads(dumps(a)) == a
True
Divides by p^shift, and truncates.
EXAMPLES:
sage: R = Zp(997, 7, 'capped-abs'); a = R(123456878908); a
964*997 + 572*997^2 + 124*997^3 + O(997^7)
Shifting to the right divides by a power of , but dropping
terms with negative valuation:
sage: a >> 3
124 + O(997^4)
A negative shift multiplies by that power of .:
sage: a >> -3
964*997^4 + 572*997^5 + 124*997^6 + O(997^7)
Addition.
EXAMPLES:
sage: R = ZpCA(13, 4)
sage: R(2) + R(3) #indirect doctest
5 + O(13^4)
sage: R(12) + R(1)
13 + O(13^4)
Division.
EXAMPLES:
sage: R = ZpCA(13, 4)
sage: R(2) / R(3) # indirect doctest
5 + 4*13 + 4*13^2 + 4*13^3 + O(13^4)
sage: a = R(169 * 2) / R(13); a
2*13 + O(13^3)
sage: R(13) / R(169 * 2)
7*13^-1 + 6 + O(13)
sage: ~a
7*13^-1 + 6 + O(13)
sage: 1 / a
7*13^-1 + 6 + O(13)
Returns the multiplicative inverse of self.
EXAMPLES:
sage: R = ZpCA(17)
sage: ~R(-1) == R(-1) #indirect doctest
True
Returns True if self is indistinguishable from zero.
EXAMPLES:
sage: R = ZpCA(7, 5)
sage: R(7^5)._is_inexact_zero()
True
sage: R(0,4)._is_inexact_zero()
True
sage: R(0)._is_inexact_zero()
True
Multiplication.
EXAMPLES:
sage: R = ZpCA(5)
sage: a = R(20,5); b = R(75, 4); a * b #indirect doctest
2*5^3 + 2*5^4 + O(5^5)
Returns the negation of self.
EXAMPLES:
sage: R = Zp(5, prec=10, type='capped-abs')
sage: a = R(1)
sage: -a #indirect doctest
4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)
Subtraction.
EXAMPLES:
sage: R = ZpCA(13, 4)
sage: R(10) - R(10) #indirect doctest
O(13^4)
sage: R(10) - R(11)
12 + 12*13 + 12*13^2 + 12*13^3 + O(13^4)
Sets self to be the Teichmuller representative with the same residue as self.
WARNING:
This function modifies self, which is not safe. Elements are supposed to be immutable.
EXAMPLES:
sage: R = ZpCA(17,5); a = R(11)
sage: a
11 + O(17^5)
sage: a._teichmuller_set(); a
11 + 14*17 + 2*17^2 + 12*17^3 + 15*17^4 + O(17^5)
sage: a.list('teichmuller')
[11 + 14*17 + 2*17^2 + 12*17^3 + 15*17^4 + O(17^5)]
Returns a new element with absolute precision decreased to prec. The precision never increases.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = Zp(7,4,'capped-abs','series'); a = R(8); a.add_bigoh(1)
1 + O(7)
sage: k = ZpCA(3,5)
sage: a = k(41); a
2 + 3 + 3^2 + 3^3 + O(3^5)
sage: a.add_bigoh(7)
2 + 3 + 3^2 + 3^3 + O(3^5)
sage: a.add_bigoh(3)
2 + 3 + 3^2 + O(3^3)
Returns whether self is equal to right modulo p^absprec.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = ZpCA(2, 6)
sage: R(13).is_equal_to(R(13))
True
sage: R(13).is_equal_to(R(13+2^10))
True
sage: R(13).is_equal_to(R(17), 2)
True
sage: R(13).is_equal_to(R(17), 5)
False
Returns whether self is zero modulo p^absprec.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = ZpCA(17, 6)
sage: R(0).is_zero()
True
sage: R(17^6).is_zero()
True
sage: R(17^2).is_zero(absprec=2)
True
Returns an integer congruent to this -adic element modulo
p^self.absprec().
EXAMPLES:
sage: R = ZpCA(3)
sage: R(10).lift()
10
sage: R(-1).lift()
3486784400
Returns a -adic integer congruent to this
-adic element
modulo p^absprec with precision at least absprec.
If such lifting would yield an element with precision greater than allowed by the precision cap of self‘s parent, an error is raised.
EXAMPLES:
sage: R = ZpCA(17)
sage: R(-1,2).lift_to_precision(10)
16 + 16*17 + O(17^10)
sage: R(1,15).lift_to_precision(10)
1 + O(17^15)
sage: R(1,15).lift_to_precision(30)
...
PrecisionError: Precision higher than allowed by the precision cap.
Returns a list of coefficients of starting with
INPUT:
OUTPUT:
NOTES:
EXAMPLES:
sage: R = ZpCA(7,6); a = R(12837162817); a
3 + 4*7 + 4*7^2 + 4*7^4 + O(7^6)
sage: L = a.list(); L
[3, 4, 4, 0, 4]
sage: sum([L[i] * 7^i for i in range(len(L))]) == a
True
sage: L = a.list('smallest'); L
[3, -3, -2, 1, -3, 1]
sage: sum([L[i] * 7^i for i in range(len(L))]) == a
True
sage: L = a.list('teichmuller'); L
[3 + 4*7 + 6*7^2 + 3*7^3 + 2*7^5 + O(7^6),
O(7^5),
5 + 2*7 + 3*7^3 + O(7^4),
1 + O(7^3),
3 + 4*7 + O(7^2),
5 + O(7)]
sage: sum([L[i] * 7^i for i in range(len(L))])
3 + 4*7 + 4*7^2 + 4*7^4 + O(7^6)
Returns the minimum possible multiplicative order of self.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = ZpCA(7, 6)
sage: R(1/3)
5 + 4*7 + 4*7^2 + 4*7^3 + 4*7^4 + 4*7^5 + O(7^6)
sage: R(1/3).multiplicative_order()
+Infinity
sage: R(7).multiplicative_order()
+Infinity
sage: R(1).multiplicative_order()
1
sage: R(-1).multiplicative_order()
2
sage: R.teichmuller(3).multiplicative_order()
6
Returns a list of coefficients of starting with
up
to
exclusive (padded with zeros if needed)
INPUT:
OUTPUT:
EXAMPLES:
sage: R = Zp(7,4,'capped-abs'); a = R(2*7+7**2); a.padded_list(5)
[0, 2, 1, 0, 0]
NOTE:
this differs from the padded_list method of padic_field_element
the slice operators throw an error if asked for a slice above the precision, while this function works
Returns the absolute precision of self.
This is the power of the maximal ideal modulo which this element is defined.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = Zp(7,4,'capped-abs'); a = R(7); a.precision_absolute()
4
Returns the relative precision of self.
This is the power of the maximal ideal modulo which the unit part of self is defined.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = Zp(7,4,'capped-abs'); a = R(7); a.precision_relative()
3
Reduces self modulo p^absprec
INPUT:
OUTPUT:
EXAMPLES:
sage: R = Zp(7,4,'capped-abs'); a = R(8); a.residue(1)
1
Returns the unit part of self.
INPUT:
OUTPUT:
EXAMPLES:
sage: R = Zp(17,4,'capped-abs', 'val-unit')
sage: a = R(18*17)
sage: a.unit_part()
18 + O(17^3)
sage: type(a)
<type 'sage.rings.padics.padic_capped_absolute_element.pAdicCappedAbsoluteElement'>
Returns a 2-tuple, the first element set to the valuation of self, and the second to the unit part of self.
If self = 0, then the unit part is O(p^0).
EXAMPLES:
sage: R = ZpCA(5)
sage: a = R(75, 6); b = a - a
sage: a.val_unit()
(2, 3 + O(5^4))
sage: b.val_unit()
(6, O(5^0))
Returns the valuation of self, ie the largest power of
dividing self.
EXAMPLES:
sage: R = ZpCA(5)
sage: R(5^5*1827).valuation()
5
TESTS:
sage: R(1).valuation()
0
sage: R(2).valuation()
0
sage: R(5).valuation()
1
sage: R(10).valuation()
1
sage: R(25).valuation()
2
sage: R(50).valuation()
2
sage: R(0).valuation()
20