25.2.2 Capped Absolute Rings

The second type of implementation of $ \mathbf{Z}_p$ is similar to the fixed modulus implementation, except that individual elements track their known precision. The absolute precision of each element is limited to be less than the precision cap of the ring, even if mathematically the precision of the element would be known to greater precision (see Appendix A for the reasons for the existence of a precision cap).

Once again, use Zp to create a capped absolute $ p$ -adic ring.

sage: R = Zp(5, prec = 10, type = 'capped-abs', print_mode = 'series')
sage: R
5-adic Ring with capped absolute precision 10

We can do similar things as in the fixed modulus case:

sage: a = R(375)
sage: a
3*5^3 + O(5^10)
sage: b = R(105)
sage: b
5 + 4*5^2 + O(5^10)
sage: a + b
5 + 4*5^2 + 3*5^3 + O(5^10)
sage: a * b
3*5^4 + 2*5^5 + 2*5^6 + O(5^10)
sage: c = a // 5
sage: c
3*5^2 + O(5^9)

Note that when we divided by 5, the precision of c dropped. This lower precision is now reflected in arithmetic.

sage: c + b
5 + 2*5^2 + 5^3 + O(5^9)

Division is allowed: the element that results is a capped relative field element, which is discussed in the next section:

sage: 1 / (c + b)
5^-1 + 3 + 2*5 + 5^2 + 4*5^3 + 4*5^4 + 3*5^6 + O(5^7)

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