9.3 $ p$ -adic numbers

How do you construct $ p$ -adics in Sage? A great deal of progress has been made on this (see SageDays talks by David Harvey and David Roe). Here only a few of the simplest examples are given.

To compute the characteristic and residue class field of the ring Zp of integers of Qp, use the syntax illustrated by the folowing examples.

sage: K = Qp(3)
sage: K.residue_class_field()
Finite Field of size 3
sage: K.residue_characteristic()
3
sage: a = K(1); a
1 + O(3^20)
sage: 82*a
1 + 3^4 + O(3^20)
sage: 12*a
3 + 3^2 + O(3^21)
sage: a in K
True
sage: b = 82*a
sage: b^4
1 + 3^4 + 3^5 + 2*3^9 + 3^12 + 3^13 + 3^16 + O(3^20)

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