Bill Allombert on Thu, 21 Dec 2023 11:46:30 +0100


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

Re: Precision too low in bnfisprincipal


On Thu, Dec 21, 2023 at 07:02:45AM +0000, Gareth Ma wrote:
> Sorry, I accidentally hit sent. Here is the code and output again:
> 
> ? \p 20000
> ? bnf = bnfinit(x^2 + 199, flag=1);

Please do not write 'flag=', just bnfinit(x^2 + 199,1) is better,
this avoid creating a global variable flag that will cause problem later.

> ? bnfisprincipal(bnf, bnf.gen[1] ^ 9)

You cannot use ^ this way, because this compute the power of the HNF matrix,
and not the ideal.

? nfisideal(bnf, bnf.gen[1] ^ 9)
%2 = 0 \\ not an ideal!

Use instead  idealpow(bnf, bnf.gen[1], 9)

Just doing 

? bnf = bnfinit(x^2 + 199, 1);
? bnfisprincipal (bnf,idealpow(bnf,bnf.gen[1],9))
%2 = [[0]~,[22,1]~]

works fine.

Cheers,
Bill.