"Source: Text/Commut/Ideal.text";
"Line: 2331";
"Date: Thu Sep 25 14:47:46 2025";
"Main: Fri Sep 26 14:29:19 2025";
// original file: Text/Commut/Ideal.text, line: 2331
// Example: H116E15 ()
print "Example: H116E15";
ei := GetEchoInput();
SetEchoInput(true);
MatSquare := function(n)
    P := PolynomialRing(RationalField(), n * n, "grevlex");
    AssignNames(
        ~P,
        ["x" cat IntegerToString(i) cat IntegerToString(j): i, j in [1..n]]
    );
    M := MatrixRing(P, n);
    X := M ! [P.((i - 1) * n + j): i, j in [1 .. n]];
    Y := X^2;
    return ideal<P | [Y[i][j]: i, j in [1 .. n]]>;
end function;
I := MatSquare(4);
I;
S<t> := HilbertSeries(I);
S;
H<d>, k := HilbertPolynomial(I);
H, k;
// Check that evaluations of H for d >= 5 match coefficients of S:
L<u> := LaurentSeriesRing(IntegerRing());       
L;
L ! S;
Evaluate(H, 5);
assert $1 eq 5927;
Evaluate(H, 6);
assert $1 eq 14832;
Evaluate(H, 19);
assert $1 eq 10892530;
SetEchoInput(ei);
