| 1 | initial version |
You can use the .slice() method. For the frac function, you may have to decide wether you want to keep the precision of your adic number or if you want to reset it to 1:
sage: floor_adic = lambda a : a.slice(0, a.precision_absolute())
sage: frac_adic = lambda a : a - a.slice(0, a.precision_absolute())
sage: frac_adic_noprec = lambda a : a.slice(a.valuation(), 0)
sage: K = Qp(11); K
11-adic Field with capped relative precision 20
sage: b = K(3211/11^2); b
10*11^-2 + 5*11^-1 + 4 + 2*11 + O(11^18)
sage: floor_adic(b)
4 + 2*11 + O(11^18)
sage: frac_adic(b)
10*11^-2 + 5*11^-1 + O(11^18)
sage: frac_adic_noprec(b)
10*11^-2 + 5*11^-1 + O(11^0)
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.