Karim Belabas on Sat, 13 Jul 2019 12:37:25 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: components of t_PADIC


* Max Alekseyev [2019-07-13 12:12]:
> Hello,
> 
> The documentation for component(x,n) gives an example:
> 
>       ? x = 3 + O(3^5);
>       ? component(x, 2)
>       %2 = 81   \\ p^(p-adic accuracy)

(Note that the [relative] p-adic accuracy is 4, not 5.)

> This example does work as stated, however for p=2 the behavior is different:
> 
> ? x = 4 + O(2^3)
> %1 = 2^2 + O(2^3)

(In this case, the [relative] p-adic accuracy is 1, not 3.)

> ? component(x,2)
> %2 = 2
> ? x.mod
> %3 = 2
> 
> So, both component(x,2) and x.mod here give 2 instead of 8. Is this a bug?

No: the (relative) p-adic accuracy is 1 and 2^1 is the expected answer.
A non-zero p-adic number is writen uniquely as p^v * (a + O(p^r)), where 
- v is a relative integer (valuation),
- 0 < a < p^r is an integer coprime to p
- r is the (relative) p-adic accuracy

* x.mod [preferred] and component(x,2) [deprecated] both return p^r.
* x.p [preferred] and component(x,1) [deprecated] both return p.
* truncate(x) and lift(x) both return p^v * a [which is a rational number]
* padicprec(x, x.p) returns v + r

> Speaking along these lines, what would the easiest way to covert t_PADIC to
> t_INTMOD? I was thinking about Mod(lift(x),x.mod)

It's not possible whenever v < 0. Assuming you have a p-adic integer

 x * Mod(1,x.mod)

should be fine. And so is Mod(x, x.mod), though more cryptic.

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 21 23
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`