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>
First, this is the session in Singular 3-1-7 (Aug 2013):
Now, this is how to see this from GAP with the properly configured Singular package (requires also the Singular system to be installed):
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 forstdhilb, so the only change needed was to replaceIby[I]. Perhaps one could figure out that something went wrong by exploring the break loop after the error message: