---Numerical Irreducible decomposition
restart
needsPackage "NumericalAlgebraicGeometry"
R=QQ[x..z]
I = ideal ((x^2+y^2+z^2-1)*(y-x^2), (x^2+y^2+z^2-1)*(z-x^3));
time P=decompose I
for p in P list degree p
for p in P list dim p
elapsedTime V = numericalIrreducibleDecomposition sub(I,CC[x..z])
peek V
W1=first V#1
points W1
W2=first V#2
points W2
degree I
--While the numerical method may be slower in serial it is highly parellizable
-- this is not so helpful on this example as the degree is small, but on
-- examples with large degree it can track each of the Bezout number paths
-- on different cores
allowableThreads
--the above parameter can be changed on a cluster to somethig quite large
restart
S=QQ[z_1,z_2,x_1..x_3]
f={z_1,z_1*z_2,z_1*z_2^2}
A=transpose matrix{{1,0},{1,1},{1,2}}
I=ideal for i from 0 to #f-1 list x_(i+1)-f_i
--note this is an example of a 'toric variety' which is
-- defined by a monomial map specified by the columns of
-- an integer matrix
I=ideal for i from 0 to #f-1 list x_(i+1)-product(0..1,j->z_(j+1)^(A_(j,i)))
R=QQ[x_1..x_3]
Ix=eliminate({z_1,z_2},I)
J=sub(Ix,R)
--- more generally
-*
restart
needsPackage "Polyhedra";
*-
A=matrix{{0,0,3,2,2},{4,0,0,1,0},{1,1,1,1,1}}
A=matrix{{1,0,1,2,3,1},{0,1,1,1,1,2},{1,1,1,1,1,1}}
n=numcols(A)-1
d=numrows(A)
S=QQ[t_1..t_(d), x_0..x_n]
I=ideal for i from 0 to n list (x_i-product(d, j->t_(j+1)^(A_(j,i))))
Ix=eliminate(toList (t_1..t_(d)),I)
R=QQ[x_0..x_n]
J=sub(Ix,R)
degree J
P=convexHull A
(dim(P))!*volume(P)
needsPackage "SumsOfSquares"
R = QQ[x,y]
f = 2*x^4 + 2*x^3*y - 2*x^2*y^2 + 5*y^4
sol = solveSOS f
s = sosPoly sol
M=x^4*y^2+x^2*y^4+1-3*x^2*y^2
--we will see that the real radical of ideal(M) is the ideal below
RRM=decompose (M+ideal jacobian ideal M)
intersect RRM
dim oo
--this ideal is all singular points of V(M), these happen to all
--be real
--we can also check that they are minima, hence if we think of
--M as a function all other points in the image are >0
--Hessian
v = matrix {{x,y}}
H=diff(v ** transpose v, M)
Heses=for vals in {{x=>1,y=>1},{x=>1,y=>-1},{x=>-1,y=>1},{x=>-1,y=>-1}} list sub(H,vals)
for h in Heses list eigenvalues h
--hence the hessian is positive definite at all
--critical points
-- Hence M is non-nagative
solveSOS M