Suggestion for printing padic values

12 views
Skip to first unread message

Ed Scheinerman

unread,
Aug 11, 2020, 9:12:34 AM8/11/20
to nemo-devel
For interacitve use, I would find it helpful if padic values were able to be represented like this: …266421216213

I've written some basic code to make that happen (see attached) though I imagine there's a more elegant way to handle this.

Example:


julia> using Nemo


Welcome to Nemo version 0.18.0


Nemo comes with absolutely no warranty whatsoever



julia> F = PadicField(7,12)

Field of 7-adic numbers


julia> sqrt(F(2))

3 + 1*7^1 + 2*7^2 + 6*7^3 + 1*7^4 + 2*7^5 + 1*7^6 + 2*7^7 + 4*7^8 + 6*7^9 + 6*7^10 + 2*7^11 + O(7^12)


julia> include("padic2str.jl")


julia> sqrt(F(2))

…266421216213


padic2str.jl

tho...@gmail.com

unread,
Aug 11, 2020, 9:30:34 AM8/11/20
to nemo-devel
Hi, and thanks for your suggestions. 

I guess this is a personal preference, but I think that the output you propose is not more helpful than the current one (for example, what you propose hides the p). Also, what do you do if p > 10? We also support "q-adic" numbers, that is, unramified extensions of Q_p, where the "digits" would be even more complicated.

Best,
Tommy

PS.: There are three printing modes in Nemo, but I guess you will find them equally unhelpful.

julia> Nemo.set_printing_mode(FlintPadicField, :terse)
:terse

julia> sqrt(F(2))
5916488742 + O(7^12)

julia> Nemo.set_printing_mode(FlintPadicField, :series)
:series

julia> sqrt(F(2))
3 + 1*7^1 + 2*7^2 + 6*7^3 + 1*7^4 + 2*7^5 + 1*7^6 + 2*7^7 + 4*7^8 + 6*7^9 + 6*7^10 + 2*7^11 + O(7^12)

julia> Nemo.set_printing_mode(FlintPadicField, :val_unit)
:val_unit

julia> sqrt(F(2))
5916488742 + O(7^12)


Ed Scheinerman

unread,
Aug 11, 2020, 9:33:51 AM8/11/20
to nemo-devel
Yup, it's a personal preference. My code will work for bases greater than 10 using a, b, c, etc for digits. Of course, that'll eventually run out!

julia> F = PadicField(17,10)

Field of 17-adic numbers


julia> sqrt(F(2))

…27ee458ee6


Thanks for the speedy reply.
Reply all
Reply to author
Forward
0 new messages