# sparseDiscriminant -- sparse discriminant (A-discriminant)

## Synopsis

• Usage:
sparseDiscriminant A
• Inputs:
• A, , a matrix over $\mathbb{Z}$ with $n$ rows to represent the exponent vectors of a Laurent polynomial $f$ in $n$ variables, $f = \sum_{\omega\in A} a_{\omega} x^{\omega}$. If one wants to perform computations only in characteristic $p>0$, then it is recommended to use the option CoefficientRing=>ZZ/p.
• Optional inputs:
• CoefficientRing => ..., default value ZZ
• Outputs:
• an instance of the type SparseDiscriminant, the universal sparse discriminant associated to $A$, that is, a function that to a Laurent polynomial $f$ in $n$ variables over a coefficient ring $K$, involving only monomials from $A$, associates the sparse discriminant of $f$, which is an element of $K$.

## Description

Alternatively, one can apply the method directly to the Laurent polynomial $f$. In this case, the matrix $A$ is automatically determined by exponentsMatrix.

As an example, we now calculate the sparse discriminant of a generic trilinear form on $\mathbb{P}^1\times\mathbb{P}^2\times \mathbb{P}^1$, that is, the hyperdeterminant of a generic three-dimensional matrix of shape $2\times 3\times 2$.

 i1 : f = genericMultihomogeneousPolynomial((2,3,2),(1,1,1)) o1 = a x y z + a x y z + a x y z + a x y z + a x y z 0,0,0 0 0 0 0,0,1 0 0 1 0,1,0 0 1 0 0,1,1 0 1 1 0,2,0 0 2 0 ------------------------------------------------------------------------ + a x y z + a x y z + a x y z + a x y z + 0,2,1 0 2 1 1,0,0 1 0 0 1,0,1 1 0 1 1,1,0 1 1 0 ------------------------------------------------------------------------ a x y z + a x y z + a x y z 1,1,1 1 1 1 1,2,0 1 2 0 1,2,1 1 2 1 o1 : ZZ[a ..a ][x ..x , y ..y , z ..z ] 0,0,0 1,2,1 0 1 0 2 0 1 i2 : time sparseDiscriminant f -- used 5.64426 seconds 2 o2 = a a a a a a - a a a a a - 0,1,1 0,2,0 0,2,1 1,0,0 1,0,1 1,1,0 0,1,0 0,2,1 1,0,0 1,0,1 1,1,0 ------------------------------------------------------------------------ 2 2 2 a a a a + a a a a a - 0,1,1 0,2,0 1,0,1 1,1,0 0,1,0 0,2,0 0,2,1 1,0,1 1,1,0 ------------------------------------------------------------------------ 2 2 2 a a a a a + a a a a - 0,0,1 0,2,0 0,2,1 1,0,1 1,1,0 0,0,0 0,2,1 1,0,1 1,1,0 ------------------------------------------------------------------------ 2 2 2 a a a a a + a a a a + 0,1,1 0,2,0 0,2,1 1,0,0 1,1,1 0,1,0 0,2,1 1,0,0 1,1,1 ------------------------------------------------------------------------ 2 a a a a a - a a a a a a + 0,1,1 0,2,0 1,0,0 1,0,1 1,1,1 0,1,0 0,2,0 0,2,1 1,0,0 1,0,1 1,1,1 ------------------------------------------------------------------------ 2 a a a a a a - a a a a a + 0,0,1 0,2,0 0,2,1 1,0,0 1,1,0 1,1,1 0,0,0 0,2,1 1,0,0 1,1,0 1,1,1 ------------------------------------------------------------------------ 2 a a a a a - a a a a a a - 0,0,1 0,2,0 1,0,1 1,1,0 1,1,1 0,0,0 0,2,0 0,2,1 1,0,1 1,1,0 1,1,1 ------------------------------------------------------------------------ 2 2 2 a a a a + a a a a a - 0,0,1 0,2,0 1,0,0 1,1,1 0,0,0 0,2,0 0,2,1 1,0,0 1,1,1 ------------------------------------------------------------------------ 2 a a a a a + a a a a a a + 0,1,1 0,2,0 1,0,0 1,0,1 1,2,0 0,1,0 0,1,1 0,2,1 1,0,0 1,0,1 1,2,0 ------------------------------------------------------------------------ 2 2 2 a a a a a - a a a a + 0,1,0 0,1,1 0,2,0 1,0,1 1,2,0 0,1,0 0,2,1 1,0,1 1,2,0 ------------------------------------------------------------------------ a a a a a a + 0,0,1 0,1,1 0,2,0 1,0,1 1,1,0 1,2,0 ------------------------------------------------------------------------ a a a a a a - 0,0,1 0,1,0 0,2,1 1,0,1 1,1,0 1,2,0 ------------------------------------------------------------------------ 2a a a a a a + 0,0,0 0,1,1 0,2,1 1,0,1 1,1,0 1,2,0 ------------------------------------------------------------------------ a a a a a a - 0,0,1 0,1,1 0,2,0 1,0,0 1,1,1 1,2,0 ------------------------------------------------------------------------ 2a a a a a a + 0,0,1 0,1,0 0,2,1 1,0,0 1,1,1 1,2,0 ------------------------------------------------------------------------ a a a a a a - 0,0,0 0,1,1 0,2,1 1,0,0 1,1,1 1,2,0 ------------------------------------------------------------------------ a a a a a a - 0,0,1 0,1,0 0,2,0 1,0,1 1,1,1 1,2,0 ------------------------------------------------------------------------ a a a a a a + 0,0,0 0,1,1 0,2,0 1,0,1 1,1,1 1,2,0 ------------------------------------------------------------------------ 2 2a a a a a a - a a a a a + 0,0,0 0,1,0 0,2,1 1,0,1 1,1,1 1,2,0 0,0,1 0,2,0 1,1,0 1,1,1 1,2,0 ------------------------------------------------------------------------ 2 a a a a a a + a a a a a - 0,0,0 0,0,1 0,2,1 1,1,0 1,1,1 1,2,0 0,0,0 0,0,1 0,2,0 1,1,1 1,2,0 ------------------------------------------------------------------------ 2 2 2 a a a a - a a a a a + 0,0,0 0,2,1 1,1,1 1,2,0 0,0,1 0,1,0 0,1,1 1,0,1 1,2,0 ------------------------------------------------------------------------ 2 2 2 2 a a a a + a a a a - 0,0,0 0,1,1 1,0,1 1,2,0 0,0,1 0,1,0 1,1,1 1,2,0 ------------------------------------------------------------------------ 2 2 2 a a a a a + a a a a - 0,0,0 0,0,1 0,1,1 1,1,1 1,2,0 0,1,1 0,2,0 1,0,0 1,2,1 ------------------------------------------------------------------------ 2 a a a a a - a a a a a a + 0,1,0 0,1,1 0,2,1 1,0,0 1,2,1 0,1,0 0,1,1 0,2,0 1,0,0 1,0,1 1,2,1 ------------------------------------------------------------------------ 2 a a a a a - 2a a a a a a + 0,1,0 0,2,1 1,0,0 1,0,1 1,2,1 0,0,1 0,1,1 0,2,0 1,0,0 1,1,0 1,2,1 ------------------------------------------------------------------------ a a a a a a + 0,0,1 0,1,0 0,2,1 1,0,0 1,1,0 1,2,1 ------------------------------------------------------------------------ a a a a a a - 0,0,0 0,1,1 0,2,1 1,0,0 1,1,0 1,2,1 ------------------------------------------------------------------------ a a a a a a + 0,0,1 0,1,0 0,2,0 1,0,1 1,1,0 1,2,1 ------------------------------------------------------------------------ 2a a a a a a - 0,0,0 0,1,1 0,2,0 1,0,1 1,1,0 1,2,1 ------------------------------------------------------------------------ 2 2 a a a a a a + a a a a - 0,0,0 0,1,0 0,2,1 1,0,1 1,1,0 1,2,1 0,0,1 0,2,0 1,1,0 1,2,1 ------------------------------------------------------------------------ 2 a a a a a + 2a a a a a a - 0,0,0 0,0,1 0,2,1 1,1,0 1,2,1 0,0,1 0,1,0 0,2,0 1,0,0 1,1,1 1,2,1 ------------------------------------------------------------------------ a a a a a a - 0,0,0 0,1,1 0,2,0 1,0,0 1,1,1 1,2,1 ------------------------------------------------------------------------ a a a a a a - 0,0,0 0,1,0 0,2,1 1,0,0 1,1,1 1,2,1 ------------------------------------------------------------------------ 2 a a a a a a + a a a a a + 0,0,0 0,0,1 0,2,0 1,1,0 1,1,1 1,2,1 0,0,0 0,2,1 1,1,0 1,1,1 1,2,1 ------------------------------------------------------------------------ 2 a a a a a a - a a a a a + 0,0,1 0,1,0 0,1,1 1,0,0 1,2,0 1,2,1 0,0,0 0,1,1 1,0,0 1,2,0 1,2,1 ------------------------------------------------------------------------ 2 a a a a a - a a a a a a - 0,0,1 0,1,0 1,0,1 1,2,0 1,2,1 0,0,0 0,1,0 0,1,1 1,0,1 1,2,0 1,2,1 ------------------------------------------------------------------------ 2 a a a a a + a a a a a a - 0,0,1 0,1,0 1,1,0 1,2,0 1,2,1 0,0,0 0,0,1 0,1,1 1,1,0 1,2,0 1,2,1 ------------------------------------------------------------------------ 2 a a a a a a + a a a a a - 0,0,0 0,0,1 0,1,0 1,1,1 1,2,0 1,2,1 0,0,0 0,1,1 1,1,1 1,2,0 1,2,1 ------------------------------------------------------------------------ 2 2 2 a a a a + a a a a a + 0,0,1 0,1,0 1,0,0 1,2,1 0,0,0 0,1,0 0,1,1 1,0,0 1,2,1 ------------------------------------------------------------------------ 2 2 2 a a a a a - a a a a 0,0,0 0,0,1 0,1,0 1,1,0 1,2,1 0,0,0 0,1,1 1,1,0 1,2,1 o2 : ZZ[a ..a ] 0,0,0 1,2,1 i3 : A = exponentsMatrix f o3 = | 0 0 0 0 0 0 1 1 1 1 1 1 | | 1 1 1 1 1 1 0 0 0 0 0 0 | | 0 0 0 0 1 1 0 0 0 0 1 1 | | 0 0 1 1 0 0 0 0 1 1 0 0 | | 1 1 0 0 0 0 1 1 0 0 0 0 | | 0 1 0 1 0 1 0 1 0 1 0 1 | | 1 0 1 0 1 0 1 0 1 0 1 0 | 7 12 o3 : Matrix ZZ <--- ZZ i4 : Disc = sparseDiscriminant A o4 = Disc o4 : SparseDiscriminant (sparse discriminant associated to | 0 0 0 0 0 0 1 1 1 1 1 1 |) | 1 1 1 1 1 1 0 0 0 0 0 0 | | 0 0 0 0 1 1 0 0 0 0 1 1 | | 0 0 1 1 0 0 0 0 1 1 0 0 | | 1 1 0 0 0 0 1 1 0 0 0 0 | | 0 1 0 1 0 1 0 1 0 1 0 1 | | 1 0 1 0 1 0 1 0 1 0 1 0 | i5 : assert(Disc f == sparseDiscriminant f)