Since, digits works with PAdicInteger only, one way is to try converting 
from PAdicRational to PAdicInteger, then apply digits:

(3) -> PR ==> PAdicRational(11)
(4) -> PI   ==> PAdicInteger(11)
(5) -> 
(5) -> x : PR := 1234

                                      2
   (5)  2 + 2 11 + 10 11
(6) -> 
(6) -> y : PI := approximate(x, 3) :: PI

                                      2
   (6)  2 + 2 11 + 10 11
(7) -> 
(7) -> digits(y)

   (7)  [2, 2, 10]
(8) ->

Is there a more direct or more efficient way to convert a PAdicRational to 
PAdicInteger?

SWA

On Tuesday, April 18, 2023 at 11:50:47 AM UTC-5 [email protected] wrote:

> When I asked for code, I actually meant some fricas input by which I can 
> at least get your first W representation.
>
> I do not, however know, how you computed your W. I get the following.
>
> PAR ==> PAdicRational(13);
> DP ==> DirectProduct(3, PAR);
> u: DP := directProduct [2, 3, 4];
> v: DP := directProduct [7, 8, 9];
> (36) -> w := u*v
>
> (36) [1 + 13, 11 + 13, 10 + 2 13]
> Type: DirectProduct(3,PAdicRational(13))
>
> Anyway, the problem with printing this in the form you want, is that 
> PAdicRational(13) simply has not enough functionality.
>
> https://fricas.github.io/api/PAdicRational.html
>
> If you only worked with a DirectProduct of PAdicInteger, then you can 
> find a digits: % -> Stream Integer function from which one could program 
> the respective output function.
>
> https://fricas.github.io/api/PAdicInteger.html
>
> Unfortunately PAdicRational does not export something to get hold of the 
> exponent or the stream data.
>
> https://github.com/fricas/fricas/blob/master/src/algebra/padic.spad#L377
>
> Ralf
>
>
> On 18.04.23 16:48, Sid Andal wrote:
> > 
> > The following two vectors
> > 
> > U := [2, 3, 4]
> > V := [7, 8, 9]
> > 
> > are in a 3-Dim Alg over the PAdicRational(13).
> > 
> > Is there a way to rewrite their product
> > 
> > 2 2 3
> > W := [6 + 13 + 7 13 , 1 + 9 13 + 7 13 , 8 13 + 7 13 ]
> > 
> > in a different form where the powers of 13 are factored out of the 
> brackets
> > per the following?
> > 
> > 2
> > 3
> > W := [6, 1, 0] + [1, 9, 8] 13 + [7, 7, 0] 13 + [0, 0, 7] 13
> > 
> > Thanks,
> > SWA
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/16be354d-259b-460c-adcc-f2dd09b49bban%40googlegroups.com.

Reply via email to