| Annegret Weng on Mon, 19 Jun 2000 22:02:53 -0400 (EDT) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| rnfisnorm |
Hello!
I have a problem with the function "rnfisnorm". It seems that I do not
know how to work with it.
I wrote a C++-program using Pari (see below) but I get an error.
The program should do the following: Given a rational prime p (as an
element of a numberfield generated by y^3+b1*y^2+b2*y+b3), determine
wheter p is a relative norm in a field extension defined by
x^2+Mod(a2*y^2+a1*y+a0,y^3+b1*y^2+b2*y+b3).
I entered for example b1=1, b2=-2 and b3=-1 and then a2=1, a1=2 and a0=1
and p=17. I got the error
*** incorrect type in principalideal.
*** Error in the PARI system. End of program.
Where is my mistake?
Thank you very much for every advice!
Best regards,
Annegret
My program:
#include<iostream.h>
extern "C" {
#include<pari/pari.h>
}
int main()
{
pari_init(100000000,2);
long prec=DEFAULTPREC;
long b1,b2,b3;
long a0,a1,a2;
const long vy=fetch_user_var("y");
const long vx=0;
GEN y=polx[vy];//Variable for number field
GEN x=polx[vx];//Variable for relative extension
GEN polynom1;//Polynomial for the number field
GEN polynom2;//Polynomial for the relative extension
long ltop;
cout << "Enter a polynomial of degree 3!" << endl;
cout << "First the coefficient of x^2, then x, then x^0:"<< endl;
cin >> b1;
cin >> b2;
cin >> b3;
//Polynomial defining the ground field of degree 3:
//y^3+b1*y^2+b2*y+b3
polynom1=gadd(gmul(y,gsqr(y)),gmulsg(b1,gsqr(y)));
polynom1=gaddsg(b3,gadd(polynom1, gmulsg(b2,y)));
cout <<"Please enter an element alpha in Z[y]" << endl;
cout <<"such that alpha=a0+a1w+a2w^2." << endl;
cin >> a0;
cin >> a1;
cin >> a2;
ltop=avma;
//Polynomial defining the relative extension:
//x^2+Mod(a2*y^2+a1*y+a0,y^3+b1*y^2+b2*y+b3)
GEN puffer=gmodulcp(gaddsg(a0,gmul(y,gaddsg(a1,gmulsg(a2,y)))),polynom1);
polynom2=gerepileupto(ltop,gadd(gsqr(x),puffer));
//Numberfield defined by y^3+b1*y^2+b2*y+b3
GEN bnf=bnfinit0(polynom1,0,NULL,prec);
//Producing the parameters required by rnfisnorm:
GEN yinx=rnfequation0(bnf,polynom2,1);
//ext required for rnfisnorm:
GEN ext=cgetg(4,t_VEC);
ext[1]=(long) polynom2;
ext[2]=rnfequation0(bnf,polynom2,1)[2];
ext[3]=(long) bnfinit0((GEN) yinx[1],0,NULL,prec);
//The prime p which we want to satisfy a relative norm equation:
long p;
cout<<"Enter a rational prime p!" << endl;
cin >> p;
GEN element=algtobasis(bnf,stoi(p));
output(rnfisnorm(bnf,ext,element,100,prec));
}