If I create the p-adics in the default way, p-adic numbers are
power series:
K=Qp(7)
a=K(1/42)
print a
6*7^-1 + 5 + 5*7 + 5*7^2 + 5*7^3 + 5*7^4 + 5*7^5 + 5*7^6 + 5*7^7 + 5*7^8 + 5*7^9 + 5*7^10 + 5*7^11 + 5*7^12 + 5*7^13 + 5*7^14 + 5*7^15 + 5*7^16 + 5*7^17 + 5*7^18 + O(7^19)
On the other hand, I can ask for p-adic digits too:
Kd=Qp(7,print_mode="digits")
a=Kd(1/42)
print a
...5555555555555555555.6
In certain contexts, I'd like to work in the power series mode up
until the end, but display my answer in digits mode. The only way
I know how to do this is to find the answer w and then use
answer=Kd(w) to turn it into digits. Is there an easier way? I
expected something like print a.digits() to work, but there's no
such attribute.
Thanks,
Fernando
-- ============================================================= Fernando Q. Gouvea http://www.colby.edu/~fqgouvea Carter Professor of Mathematics Dept. of Mathematics and Statistics Colby College 5836 Mayflower Hill Waterville, ME 04901 Deck us all with Boston Charlie, Walla Walla, Wash., an' Kalamazoo! Nora's freezin' on the trolley, Swaller dollar cauliflower, alleygaroo! Don't we know archaic barrel, Lullaby Lilla Boy, Louisville Lou. Trolley Molly don't love Harold, Boola boola Pensacoola hullabaloo! --Walt Kelly
In certain contexts, I'd like to work in the power series mode up until the end, but display my answer in digits mode. The only way I know how to do this is to find the answer w and then use answer=Kd(w) to turn it into digits. Is there an easier way? I expected something like print a.digits() to work, but there's no such attribute.