Singular.jl example
Example for Singular.jl
Load Singular
using Singular
Singular.jl, based on SINGULAR / A Computer Algebra System for Polynomial Computations / Singular.jl: 0.14.0 0< Singular : 4.3.1p2 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann \ FB Mathematik der Universitaet, D-67653 Kaiserslautern \
Generate an integer polynomial ring
R, ( x, y, z ) = PolynomialRing( ZZ, [ "x", "y", "z" ] )
(Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C), spoly{n_Z}[x, y, z])
Create some polynomials
p = x + y + z
q = x + y^2 + z^3
r = x^3 + y^3 + z^3
x^3 + y^3 + z^3
Create an ideal containing the polynomials p,q,r
ideal = Ideal( R, [ p, q, r ] )
Singular ideal over Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C) with generators (x + y + z, z^3 + y^2 + x, x^3 + y^3 + z^3)
Compute a standard basis of the ideal
basis = std( ideal )
Singular ideal over Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C) with generators (x + y + z, z^3 + y^2 - y - z, 3*y^2*z + 3*y*z^2, 3*y^4 - 6*y^3 + 3*y*z^2 + 3*y^2 + 3*y*z)
Compute the ideal of leading monomials of basis
basis_lead = lead( basis )
Singular ideal over Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C) with generators (x, z^3, 3*y^2*z, 3*y^4)
Compute the syzygies of basis
basis_syzygies = syz( basis )
Singular Module over Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C), with Generators: 3*y^2*gen(2)+3*y*z*gen(2)-z^2*gen(3)-y*gen(3)-3*y*gen(2)+z*gen(3)-gen(4)+2*gen(3) y^2*gen(3)-y*z*gen(3)-3*y*z*gen(2)+z^2*gen(3)-y*gen(3)-z*gen(4)+z*gen(3) z^3*gen(1)+y^2*gen(1)-x*gen(2)-y*gen(2)-y*gen(1)-z*gen(2)-z*gen(1) 3*y^2*z*gen(1)+3*y*z^2*gen(1)-x*gen(3)-y*gen(3)-z*gen(3) 3*y^4*gen(1)-6*y^3*gen(1)+3*y*z^2*gen(1)+3*y^2*gen(1)+3*y*z*gen(1)-x*gen(4)-y*gen(4)-z*gen(4)
Compute the standard basis of the syzygies
std_syzygies = std( basis_syzygies )
Singular Module over Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C), with Generators: 3*y^2*gen(2)+3*y*z*gen(2)-z^2*gen(3)-y*gen(3)-3*y*gen(2)+z*gen(3)-gen(4)+2*gen(3) y^2*gen(3)-y*z*gen(3)-3*y*z*gen(2)+z^2*gen(3)-y*gen(3)-z*gen(4)+z*gen(3) z^3*gen(1)+y^2*gen(1)-x*gen(2)-y*gen(2)-y*gen(1)-z*gen(2)-z*gen(1) 3*y^2*z*gen(1)+3*y*z^2*gen(1)-x*gen(3)-y*gen(3)-z*gen(3) 3*y^4*gen(1)-6*y^3*gen(1)+3*y*z^2*gen(1)+3*y^2*gen(1)+3*y*z*gen(1)-x*gen(4)-y*gen(4)-z*gen(4)
Use a polynomial ring over a Nemo number field
import Nemo
R, t = Nemo.PolynomialRing(Nemo.QQ, "t")
K, a = Nemo.NumberField(t^3 + 3t + 1, "a")
S, (x, y, z) = PolynomialRing(K, ["x", "y", "z"])
(Singular Polynomial Ring (Coeffs(17)),(x,y,z),(dp(3),C), spoly{Singular.n_FieldElem{Nemo.nf_elem}}[x, y, z])
Create some polynomials
p = x + a^2*y + a*z
q = x + 2*a*y^2 + (a^2+a)*z^3
r = x^3 + y^3 + a*z^3
x^3 + y^3 + a*z^3
Create an ideal containing the polynomials p,q,r
ideal = Ideal( S, [ p, q, r ] )
Singular ideal over Singular Polynomial Ring (Coeffs(17)),(x,y,z),(dp(3),C) with generators (x + a^2*y + a*z, (a^2 + a)*z^3 + 2*a*y^2 + x, x^3 + y^3 + a*z^3)
Compute a standard basis of the ideal
basis = std( ideal )
Singular ideal over Singular Polynomial Ring (Coeffs(17)),(x,y,z),(dp(3),C) with generators (x + a^2*y + a*z, z^3 + (2//3*a^2 - 2//3*a + 8//3)*y^2 + (1//3*a^2 - 1//3*a + 1//3)*y + (-1//3*a^2 + 1//3*a - 4//3)*z, y^3 + (-6//35*a^2 - 31//35*a - 9//35)*y^2*z + (9//35*a^2 - 6//35*a - 4//35)*y*z^2 + (2//7*a^2 - 4//21*a + 16//21)*y^2 + (2//21*a^2 + 1//21*a + 1//7)*y + (-1//7*a^2 + 2//21*a - 8//21)*z)