Open miguelmarco opened 1 year ago
config.log please so we can see where your libraries are coming from
Is it supposed to work? Does it work on singular directly? I have no experience of working with singular for polynomials with integer coefficients.
Is it supposed to work? Does it work on singular directly? I have no experience of working with singular for polynomials with integer coefficients.
Yes, it does work in singular. In fact, it does work with the old (pexpect-based) interface:
sage: R.<x,y,z> = ZZ[]
sage: M = matrix(R,[[x,y,x],[x^2+z,y^2,x+y-z]])
sage: M._singular_().std()._sage_()
[ x y x^2 - x*y + x*z - x + y x*y*z - x*y + y^2 - 3*y*z y^3 - 2*y^2*z - 2*y^2 + 5*y*z x*y^2 - x*y - y^2 + y*z]
[ x + y - z y^2 2*y*z - z^2 - z -y*z^2 - y*z y*z^2 + y*z 0]
config.log please so we can see where your libraries are coming from
Does it work for you? It crashes in every system I tested.
ping @kwankyu @mkoeppe
It works with Singular
SINGULAR / Development
A Computer Algebra System for Polynomial Computations / version 4.3.2
0<
by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann \ Feb 2023
FB Mathematik der Universitaet, D-67653 Kaiserslautern \
> ring R = integer,(x,y,z), dp;
> vector s1 = [x,y,x];
> vector s2 = [x^2+z,y^2,x+y-z];
> module m = s1,s2;
> std(m);
_[1]=x*gen(3)+x*gen(1)+y*gen(2)
_[2]=x2*gen(1)+y2*gen(2)-x*gen(1)+y*gen(3)-y*gen(2)-z*gen(3)+z*gen(1)
In Sage,
sage: R.<x,y,z> = ZZ[]
sage: M = matrix(R,[[x,y,x],[x^2+z,y^2,x+y-z]])
sage: std(M,ring=R)
[(x, x + y - z), (y, y^2), (x^2 - x*y + x*z - x + y, 2*y*z - z^2 - z), (x*y*z - x*y + y^2 - 3*y*z, -y*z^2 - y*z), (y^3 - 2*y^2*z - 2*y^2 + 5*y*z, y*z^2 + y*z), (x*y^2 - x*y - y^2 + y*z, 0)]
which seems wrong. For std(M)
, it seems to have never worked. I checked with 9.7 and later.
So if you want this "feature", you are on your own.
I guess what happens in the example you posted has to do with considering the module as represented by the rows of the matrix vs the one corresponding to the columns:
sage: std(M.T,ring=R)
[(x, y, x), (x^2 - x + z, y^2 - y, y - z)]
So it seems that the problem comes from not using the ring
keyword. That is interesting, since that keyword is not needed when the polynomial ring is defined over a field.
Right... I didn't see that. So the "fix" may be easy.
You may need to look into src/sage/libs/singular/function.pyx
.
I see. It seems that the difference from the field case is the type of the matrix:
sage: type(M)
<class 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
whereas the code that tries to guess the ring of the input checks for more specific types:
So I guess this could be fixed by using Matrix_mpolynomial_dense
for matrices with coefficients in a integer polynomial ring.
In the meantime, just specifying the ring seems to solve it. Thank you!
Steps To Reproduce
In a fresh sage session, run
Expected Behavior
A result similar to what you get with rational coefficients:
Actual Behavior
Get this error message
Additional Information
No response
Environment
Checklist