\\Computes and returns the splitting type of the pullback of the cotangent bundle of a morphism into P^5,
\\takes as input the 6 polynomials that define the morphism and the degree of the morphism d.
\\Assumes polynomial in formal variables [S,T].

find_splittingType(G0,G1,G2,G3,G4,G5) =
{
local(r,i,m,e,d);
d=0;

degree = vector(6);
degree[1] = G0;
degree[2] = G1;
degree[3] = G2;
degree[4] = G3;
degree[5] = G4;
degree[6] = G5;
for(z=1,6,
  if(degree[z] != 0,
    d1 = poldegree(subst(degree[z],T,S), S);
    d = max(d1,d)
  )
);    

e = vector(5);
m = d; r = 0; i = 0;

while(r < 5, 
     rTemp = r;
     r = rTemp + hilbert_function(G0,G1,G2,G3,G4,G5,d,m) - i;
    
     j = 0;
    while(j < r - rTemp,
         e[rTemp + 1 + j] = -m;
         j++);
 
     i = i + rTemp + 2 *(r-rTemp);
    m++);

for(i=1, 5, 
  e[i] = 4*e[i] + 5*d
);
return(e)
}

hilbert_function(G0,G1,G2,G3,G4,G5,d,m) =
{
local(G,A,i,j,k);
G = [G0,G1,G2,G3,G4,G5];

A = matrix(m+1,(6) * (-d + m + 1));
i = 0;
j = 1;
k= 0;
while(i <= 5,
     while(j <= -d + m + 1,
            while(k <= d,
                   A[j + k,i*(-d + m + 1) + j] = polcoeff(polcoeff(G[i+1],d-k,S),k,T);
                   k++);
     j++;k=0);
i++;j=1);

return((6 * (-d + m + 1) - matrank(A)))
}