Gareth Ma on Thu, 21 Dec 2023 14:25:54 +0100


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

Re: Precision too low in bnfisprincipal


Thank you both for the help, it works perfectly now :)

I used the `flag=` because I came from Sage, but I'll stop doing that.

Best regards,

Gareth

On 21/12/2023 10:46, Bill Allombert wrote:
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.