On Thursday, August 8, 2019 at 7:16:21 AM UTC-7, Fernando Gouvea wrote:
>
> 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.
>

The print-mode does not affect how the computations are done. So your work 
will be done the same way no matter what print-mode is selected

To access the p-adic digits, you can use "Qp(7)(1/42).list()"

You can give a mode to the "str" method that returns a string 
representation. e.g. Qp(7)(1/42).str(mode="bars") gives a presentation that 
makes the digits obvious. In principle Qp(7)(1/42).str(mode="digits") 
should work but it seems to miss some initialization. You could work around 
that by coercing into another p-adic ring with the desired print options 
set:

k1=Qp(7)
k2=Qp(7,print_mode="digits")
a=k1(2).sqrt()
print k2(a)

 

> 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
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/8fd20d0f-89c8-4f6b-a7c3-1ab4f4c6963c%40googlegroups.com.

Reply via email to