| Karim Belabas on Sat, 15 Feb 2025 13:39:03 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: t_PADIC to t_INTMOD and use of chinese() |
* Karim Belabas [2025-02-14 15:31]:
> * Max Alekseyev [2025-02-14 15:09]:
> > dueHello,
> >
> > I have a couple of requests:
> >
> > 1) An easy way to convert t_PADIC to t_INTMOD, maybe extending Mod() to
> > support a single argument of type t_PADIC, e.g. Mod(1 + O(5^2)) would
> > produce Mod(1, 25).
>
> padic2mod(x) = Mod(x, x.p^padicprec(x, x.p));
Not sure about making this one built-in as Mod(x), but easy to do.
It could just as easily work recursively for polynomials, series, vectors,
matrices as well (we couldn't then extend to the comparatively less
useful Mod(x + O(x^2)) -> Mod(x, x^2))
But what would be the use cases ?
I would expect that the user would know the p-adic accuracy and just use
Mod(x, p^d) for the right d (which would also work recursively, compared
to my padic2mod which requires x to be a t_PADIC in order to determine a
proper d)
> > 2) Extend chinese() to support t_PADIC arguments (still producing t_INTMOD).
>
> padicchinese(v) = chinese(apply(padic2mod, v))
>
> ? padicchinese([1 + O(5^2), 3 + O(3^3)])
> %3 = Mod(651, 675)
This one is now built-in in the 'master' branch: t_PADICs and t_INTMODs
can be used interchangeably.
? chinese(1 + O(5^2), 3 + O(3^3))
%1 = Mod(651, 675)
? chinese((1+O(7)) * (x+1), Mod(x^2+1, 5))
%2 = Mod(21, 35)*x^2 + Mod(15, 35)*x + Mod(1, 35)
? H = mathilbert(3); chinese(H * (1 + O(7^2)), Mod(H, 11))
%3 =
[ Mod(1, 539) Mod(270, 539) Mod(180, 539)]
[Mod(270, 539) Mod(180, 539) Mod(135, 539)]
[Mod(180, 539) Mod(135, 539) Mod(108, 539)]
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/