Bill Allombert on Fri, 07 Apr 2017 23:56:54 +0200


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

Re: Annoying typing problem


On Fri, Apr 07, 2017 at 02:34:10PM -0700, Watson Ladd wrote:
> Dear all,
> 
> I want to convert the output of rnfdisc(K, pol)[2] into an element of
> K. If it was always a vector, this would be easy, the same as if it
> was always a polmod or integer. But sadly it is sometimes one and
> sometimes the other. I have searched the manual and found nothing that
> works. This would be an easy function to write if I could tell what
> type rnfdisc(K, pol)[2] has, but there is no function for that either.

Maybe you can use nfbasistoalg resp. nfalgtobasis ?
They actually work for all formats not just t_VEC resp. t_POLMOD.

? N=nfinit('a^2+1);
? nfbasistoalg(N,a)
%14 = Mod(a,a^2+1)
? nfbasistoalg(N,[1,2]~)
%15 = Mod(2*a+1,a^2+1)
? nfbasistoalg(N,Mod(a+1,a^2+1))
%16 = Mod(a+1,a^2+1)

Cheers,
Bill.