how to use hilbert function in gap system with loadpackage singular

211 Views Asked by At

how to calculate hilbert function as it do in singular code

singular code

ring  r = 0,(x,y,z),lp;
ideal i = y3+x2,x2y+x2z2,x3-z9,z4-y2-xz;
ideal j = stdhilb(i); j;

gap code

R1:= PolynomialRing( Rationals, ["x","y","z"] : new );;
SingularSetBaseRing(R1);
x:=IndeterminatesOfPolynomialRing(R1)[1];
y:=IndeterminatesOfPolynomialRing(R1)[2];
z:=IndeterminatesOfPolynomialRing(R1)[3];
f1:=y^3+x^2;
f2:=x^2*y+x^2*z^2;
f3:=x^3-z^9;
f4:=z^4-y^2-x*z;
#stdhilb([f1,f2,f3,f4]);

gap> I:= Ideal( R1, [f1,f2,f3,f4] );
<two-sided ideal in Rationals[x,y,z], (4 generators)>
gap> SingularInterface( "stdhilb", I, "ideal");
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Length' on 1 arguments called from
Length( arguments ) called from
<function "SingularInterface">( <arguments> )
 called from read-eval loop at line 49 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> quit;
gap> SingularInterface( "stdhilb", [ f1,f2,f3,f4 ], "def");
   ? `poly`(Id(1)) = `ideal` is not supported
   ? expected `poly` = `poly`
   ? expected `poly` = `matrix`
   ? error occurred in or before standard.lib::stdhilb line 304: `    return(slimgb(i));`
   ? leaving standard.lib::stdhilb
#I  Singular output of type "none"
No output from Singular
""
gap> 
gap> SingularInterface( "stdhilb", [ f1,f2,f3,f4 ], "poly");
   ? `poly`(Id(1)) = `ideal` is not supported
   ? expected `poly` = `poly`
   ? expected `poly` = `matrix`
   ? error occurred in or before standard.lib::stdhilb line 304: `    return(slimgb(i));`
   ? leaving standard.lib::stdhilb
0
gap> SingularInterface( "stdhilb", [ f1,f2,f3,f4 ], "poly");
   ? `poly`(Id(1)) = `ideal` is not supported
   ? expected `poly` = `poly`
   ? expected `poly` = `matrix`
   ? error occurred in or before standard.lib::stdhilb line 304: `    return(slimgb(i));`
   ? leaving standard.lib::stdhilb
0
gap> SingularInterface( "stdhilb", [ f1,f2,f3,f4 ], "matrix");
   ? `poly`(Id(1)) = `ideal` is not supported
   ? expected `poly` = `poly`
   ? expected `poly` = `matrix`
   ? error occurred in or before standard.lib::stdhilb line 304: `    return(slimgb(i));`
   ? leaving standard.lib::stdhilb
[ [ 0 ] ]
gap> SingularInterface( "stdhilb", f1, "def");
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Length' on 1 arguments called from
Length( arguments ) called from
<function "SingularInterface">( <arguments> )
 called from read-eval loop at line 54 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> quit;
gap> stdhilb([f1,f2,f3,f4]);
Error, Variable: 'stdhilb' must have a value
not in any function at line 55 of *stdin*
gap> stdhilb(I);
Error, Variable: 'stdhilb' must have a value
not in any function at line 56 of *stdin*
gap> SingularInterface( "stdhilb", Matrix([[ f1, f2, f3, f4 ]]), "matrix");
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Matrix' on 1 arguments called from
<function "HANDLE_METHOD_NOT_FOUND">( <arguments> )
 called from read-eval loop at line 59 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> quit;
gap> SingularInterface( "stdhilb", Matrix([ f1, f2, f3, f4 ]), "matrix");
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Matrix' on 1 arguments called from
<function "HANDLE_METHOD_NOT_FOUND">( <arguments> )
 called from read-eval loop at line 59 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue

in version gap4r5, above code top 2 lines of code can run without error after install the latest version today, set base ring return error

gap> SingularSetBaseRing(R1);
Error, IsBound: <list> must be a list (not a boolean) in
  if
 not IsBound( SingularTempDirectory![1]) 
        or not IsDirectoryPath( SingularTempDirectory![1] ) = true 
      or not IsWritableFile( SingularTempDirectory![1] ) = true 
    or not IsExecutableFile( SingularTempDirectory![1] ) = true  then
    SingularTempDirectory := DirectoryTemporary( "Sing" );
    if SingularTempDirectory = fail  then
        Error( "cannot create a temporary directory\n" );
    fi;
    Info( InfoSingular, 2, "Using temporary ", SingularTempDirectory );
fi; called from 
CheckSingularExecutableAndTempDir(  ); called from
StartSingular(  ); called from
SingCommandInStreamOutStream( ParseGapRingToSingRing( R ), "" ); called from
<function "SingularSetBaseRing">( <arguments> )
 called from read-eval loop at line 6 of *stdin*
you can replace <list> via 'return <list>;'
brk> 
1

There are 1 best solutions below

1
On BEST ANSWER

First, this is the session in Singular 3-1-7 (Aug 2013):

> ring  r = 0,(x,y,z),lp;
> ideal i = y3+x2,x2y+x2z2,x3-z9,z4-y2-xz;
> ideal j = stdhilb(i); j;
j[1]=z10
j[2]=yz9
j[3]=2y2z4-z8
j[4]=2y3z3-2y2z5-yz7
j[5]=y4+y3z2
j[6]=xz+y2-z4
j[7]=xy2-xz4-y3z
j[8]=x2+y3

Now, this is how to see this from GAP with the properly configured Singular package (requires also the Singular system to be installed):

gap> LoadPackage("singular");
─────────────────────────────────────────────────────────────────────────────
Loading  singular 12.04.28 (The GAP interface to Singular)
by Marco Costantini (http://www-math.science.unitn.it/~costanti/) and
   Willem de Graaf (http://www.science.unitn.it/~degraaf/).
Homepage: http://www.gap-system.org/HostedGapPackages/singular/
─────────────────────────────────────────────────────────────────────────────
true
gap> R1:= PolynomialRing( Rationals, ["x","y","z"] : new );;
gap> SetTermOrdering(R1,"lp");
gap> SingularSetBaseRing(R1);
gap> x:=IndeterminatesOfPolynomialRing(R1)[1];;
gap> y:=IndeterminatesOfPolynomialRing(R1)[2];;
gap> z:=IndeterminatesOfPolynomialRing(R1)[3];;
gap> f1:=y^3+x^2;;
gap> f2:=x^2*y+x^2*z^2;;
gap> f3:=x^3-z^9;;
gap> f4:=z^4-y^2-x*z;;
gap> I:= Ideal( R1, [f1,f2,f3,f4] );
<two-sided ideal in Rationals[x,y,z], (4 generators)>
gap> S:=SingularInterface( "stdhilb", [I], "ideal");
<two-sided ideal in Rationals[x,y,z], (8 generators)>
gap> GeneratorsOfIdeal(S);
[ z^10, y*z^9, -z^8+2*y^2*z^4, -y*z^7-2*y^2*z^5+2*y^3*z^3, y^3*z^2+y^4, 
  -z^4+x*z+y^2, -x*z^4-y^3*z+x*y^2, y^3+x^2 ]
gap> 

One could check that the list of polynomials is the same.

The reason for failure given in the question was that the 2nd argument of SingularInterface (as its manual entry specifies) should be the list of arguments for stdhilb, so the only change needed was to replace I by [I]. Perhaps one could figure out that something went wrong by exploring the break loop after the error message:

gap> S:=SingularInterface( "stdhilb", I, "ideal");
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Length' on 1 arguments called from
Length( arguments ) called from
<function "SingularInterface">( <arguments> )
 called from read-eval loop at line 15 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> arguments;
<two-sided ideal in Rationals[x,y,z], (4 generators)>
brk>