Once again, use Zp
to create a capped absolute
-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.