Search code examples
number-theorypari-gp

How to solve the error ' [not a vector ]'


I ran this code to find the norm of some fundamnetal units of a biqaudratic number field, but I faced following problem

for (q=5, 200,  for(p=q+1, 200,  if (isprime(p)==1 && isprime(q)==1 ,k1=bnfinit(y^2-2*p,1); k2=bnfinit(y^2-q,1);  k3=bnfinit(y^2-2*p*q,1); ep1=k1[8][5][1]; ep2=k2[8][5][1]; ep3=k3[8][5][1]; normep1=nfeltnorm(k1,ep1); normep2=nfeltnorm(k2,ep2); normep3=nfeltnorm(k3,ep3); li=[[q,p], [normep1, normep2, normep3]]; lis4=concat(lis4,[li]))))

and it works for small p and q. However, when I ran that for p and q greater than 150, it gives the following error:

Error picture

First, I didn't use the flag=1 for bnf, but after adding that, still I get the same error.


Solution

  • Please, do not use indexing like ...[8][5][1] to get the fundamental units (FU). It seems that bnfinit omits FU matrix for some p and q. Instead, use the member function fu to receive FU. Please, find the example below:

    
    > [q, p] = [23, 109];
    > k = bnfinit(y^2 - 2*p*q, 1);
    > k[8][5]
    [;]
    > k[8][5][1]  \\ you will get the error here trying to index the empty matrix.
    ...
    incorrect type in _[_] OCcompo1 [not a vector] (t_MAT).
    
    > k.fu
    [Mod(-355285121749346859670064114879166870*y - 25157598731408198132266996072608016699, y^2 - 5014)]
    > norm(k.fu[1])
    1