--isolated and embedded primes
R =QQ[x..z,w]
X= ideal ( w * x ^2 - y ^3,y)
J=ideal mingens(X+minors(codim(X),jacobian X))
P=primaryDecomposition J
for p in P list radical p
--the first component p0 is a minimal (or isolated) associated prime
--the second p1 is an embedded prime
--the compont p1 is embedded since V(p1) \subset V(p0)
isSubset(radical P_0,radical P_1)
--alternitively if we take the radical of J we see that only the minimal
--associated prime occurs
radical J
--note that the M2 'decompose' command only computes the minimal primes
decompose J
primaryDecomposition ideal (x^2,x*y)
restart
R=QQ[x..z]
I=ideal(x*y^2*z^3,x^2*y*z^3,x*y^3*z^2,x^3*y*z^2,x^2*y^3*z^2,x^3*y^2*z)
P=primaryDecomposition I
dim I
for p in P list dim p
decompose I
restart
R=QQ[x,y]
I=ideal(x*y-1)
eliminate(x,I)
--so the closure of the projection is all of k^1
--We can also use elimination to find algebraic relations
--Consider the power sums:
restart
R=QQ[p_1..p_4,x..z]
--let the p_i's denote the ith power sum x^i+y^i+z^i
--the first 4 power sums are
I=ideal for i from 1 to 4 list (p_i-(x^i+y^i+z^i))
-- projecting onto (p_1,...,p_4) will tell us how the different power sums
-- are related
eliminate({x,y,z},I)
--or
eliminate(toList(x..z),I)
--this can be done with a lex GB
--(or actually some other monomial orders, called elimination orders, as well)
restart
S=QQ[x..z,p_1..p_4,MonomialOrder=>Lex]
-- we want Lex with p_1Lex]
-- in general we would just take all the polynomials in G which are only in QQ[p_1..p_4]
-- in this case there is only one.
restart
R=QQ[x..z,p_1..p_4,MonomialOrder=>{Eliminate (3)}];
I=ideal for i from 1 to 4 list (p_i-(x^i+y^i+z^i))
ideal selectInSubring(1, groebnerBasis(I))
--Now consider an explicit power sum
restart
S=QQ[x..z,MonomialOrder=>Lex]
I=ideal for i from 1 to 3 list (i-(x^i+y^i+z^i))
degree I
G=ideal groebnerBasis I
needsPackage "NumericalAlgebraicGeometry"
zcoords= for sol in solveSystem {sub(G_0,CC[z])} list first coordinates sol
S2=CC[y,z]
gyz=sub(G_1,S2)
polysy=sub(gyz,{z=>zcoords_0})
ypoints=solveSystem({sub(polysy,CC[y])})
ycoords=for p in ypoints list first coordinates p
sub(gyz,{S2_1=>zcoords_0,S2_0=>ycoords_0})
sub(gyz,{S2_1=>zcoords_0,S2_0=>ycoords_1})
--this gives us two of the six solutions, doing the same for the other 2 roots of G_0
--gives the remaining 4
solveSystem flatten entries gens I
--the elimination theorem tells us that
-- the first polnomial is a GB for I \cap QQ[z]
-- the first two for I \cap QQ[y,z]
--this means that the roots of first equation
--are all roots that project to the the z coordinate from
-- C^3... so we can solve by back subsitution to obtain all
--solutons to the system
--In this case we know we go the correct number of solutions by listing projections
--since we found 6 distinct solutions and
degree I
radical(I)==I