# Singular

#### D.4.22.2 primitive_extra

Procedure from library primitiv.lib (see primitiv_lib).

Usage:
primitive_extra(i); i ideal

Assume:
The ground field of the basering is k=Q or k=Z/pZ and the ideal i is given by 2 generators f,g with the following properties:
 f is the minimal polynomial of a in k[x], g is a polynomial in k[x,y] s.th. g(a,y) is the minpoly of b in k(a)[y].
Here, x is the name of the first ring variable, y the name of the second.

Return:
ideal j in k[y] such that
 j[1] is the minimal polynomial for a primitive element c of k(a,b) over k, j[2] is a polynomial s.th. j[2](c)=a.

Note:
While primitive(i) may fail for finite fields, primitive_extra(i) tries all elements of k(a,b) and, hence, always finds a primitive element.
In order to do this (try all elements), field extensions like Z/pZ(a) are not allowed for the ground field k.
primitive_extra(i) assumes that the second generator, g, is monic as polynomial in (k[x])[y].

Example:
 LIB "primitiv.lib"; ring exring=3,(x,y),dp; ideal i=x2+1,y3+y2-1; primitive_extra(i); ==> _[1]=y6-y5+y4-y3-y-1 ==> _[2]=y5+y4+y2+y+1 ring extension=(3,y),x,dp; minpoly=y6-y5+y4-y3-y-1; number a=y5+y4+y2+y+1; a^2; ==> -1 factorize(x2+1); ==> [1]: ==> _[1]=1 ==> _[2]=x+(y5+y4+y2+y+1) ==> _[3]=x+(-y5-y4-y2-y-1) ==> [2]: ==> 1,1,1 factorize(x3+x2-1); ==> [1]: ==> _[1]=1 ==> _[2]=x+(y5+y4+y2+1) ==> _[3]=x+(-y5-y4-y3-y2-y-1) ==> _[4]=x+(y3+y+1) ==> [2]: ==> 1,1,1,1