Singular.jl example

Example for Singular.jl

In :
using Singular

Welcome to Nemo version 0.16.4-dev

Nemo comes with absolutely no warranty whatsoever



Generate an integer polynomial ring

In :
R, ( x, y, z ) = PolynomialRing( ZZ, [ "x", "y", "z" ] )

Out:
(Singular Polynomial Ring (ZZ),(x,y,z),(dp(3),C), spoly{n_Z}[x, y, z])

Create some polynomials

In :
p = x + y + z
q = x + y^2 + z^3
r = x^3 + y^3 + z^3

Out:
x^3+y^3+z^3

Create an ideal containing the polynomials p,q,r

In :
ideal = Ideal( R, [ p, q, r ] )

Out:
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

In :
basis = std( ideal )

Out:
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

In :
basis_lead = lead( basis )

Out:
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

In :
basis_syzygies = syz( basis )

Out:
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

In :
std_syzygies = std( basis_syzygies )

Out:
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

In :
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"])

Out:
(Singular Polynomial Ring (Coeffs(19)),(x,y,z),(dp(3),C), spoly{Singular.n_unknown{Nemo.nf_elem}}[x, y, z])

Create some polynomials

In :
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

Out:
x^3+y^3+(a)*z^3

Create an ideal containing the polynomials p,q,r

In :
ideal = Ideal( S, [ p, q, r ] )

Out:
Singular Ideal over Singular Polynomial Ring (Coeffs(19)),(x,y,z),(dp(3),C) with generators (x+(a^2)*y+(a)*z, (a^2 + 1*a)*z^3+(2*a)*y^2+x, x^3+y^3+(a)*z^3)

Compute a standard basis of the ideal

In :
basis = std( ideal )

Out:
Singular Ideal over Singular Polynomial Ring (Coeffs(19)),(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)