# Artin decomposition for p-adic numbers

How can I decompose a p-adic number

... d_2 d_1 d_0. d_{-1} ... d_{-k}

into its integer part

d_2 d_1 d_0.

and fractional part

. d_{-1} ... d_{-k} ?

The does not seem to exist a kind of floor function.

edit retag close merge delete

Sort by ยป oldest newest most voted

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)

4 + 2*11 + O(11^18)
10*11^-2 + 5*11^-1 + O(11^18)
10*11^-2 + 5*11^-1 + O(11^0)

more

Thank you very much!

more

If this helped you, please click the accept button in the answer! Then others will know that this question has a correct answer when they search.

( 2013-10-27 20:21:00 +0100 )edit