//This is the ideal Fourier invariants. ring rQ = 0,(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12),dp; ideal Invariants = q9*q10-q11*q12, q7*q10-q8*q12, q6*q10-q8*q11, q4*q10-q5*q12, q3*q10-q5*q11, q8*q9-q7*q11, q8*q9-q6*q12, q5*q9-q3*q12, q5*q9-q4*q11, q5*q8-q2*q10, q5*q7-q2*q12, q5*q7-q4*q8, q5*q6-q2*q11, q5*q6-q3*q8, q4*q6-q1*q10, q4*q6-q2*q9, q4*q6-q3*q7, q4*q7*q9-q1*q12^2, q3*q6*q9-q1*q11^2, q2*q6*q7-q1*q8^2, q2*q3*q4-q1*q5^2; // This is the inverse of the Fourier transform. matrix ptoq[15][12] = 1/64,3/64,3/64,3/64,3/32,3/64,3/64,3/32,3/64,21/64,3/32,3/32, 3/64,-3/64,-3/64,9/64,-3/32,-3/64,9/64,-3/32,9/64,-21/64,-3/32,9/32, 3/64,-3/64,9/64,-3/64,-3/32,9/64,-3/64,-3/32,9/64,-21/64,9/32,-3/32, 3/64,9/64,-3/64,-3/64,-3/32,-3/64,-3/64,-3/32,9/64,15/64,-3/32,-3/32, 3/32,-3/32,-3/32,-3/32,3/16,-3/32,-3/32,3/16,9/32,3/32,-3/16,-3/16, 3/64,9/64,-3/64,-3/64,-3/32,9/64,9/64,9/32,-3/64,-21/64,-3/32,-3/32, 3/64,-3/64,9/64,-3/64,-3/32,-3/64,9/64,-3/32,-3/64,15/64,-3/32,-3/32, 3/32,-3/32,-3/32,-3/32,3/16,-3/32,9/32,-3/16,-3/32,3/32,3/16,-3/16, 3/64,-3/64,-3/64,9/64,-3/32,9/64,-3/64,-3/32,-3/64,15/64,-3/32,-3/32, 3/64,9/64,9/64,9/64,9/32,-3/64,-3/64,-3/32,-3/64,-21/64,-3/32,-3/32, 3/32,-3/32,-3/32,9/32,-3/16,-3/32,-3/32,3/16,-3/32,3/32,3/16,-3/16, 3/32,-3/32,-3/32,-3/32,3/16,9/32,-3/32,-3/16,-3/32,3/32,-3/16,3/16, 3/32,-3/32,9/32,-3/32,-3/16,-3/32,-3/32,3/16,-3/32,3/32,-3/16,3/16, 3/32,9/32,-3/32,-3/32,-3/16,-3/32,-3/32,-3/16,-3/32,3/32,3/16,3/16, 3/32,-3/32,-3/32,-3/32,3/16,-3/32,-3/32,3/16,-3/32,-9/32,3/16,3/16; // This is the ring of probability distributions. ring rP = 0,(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15),dp; //This is the Fourier transform. matrix qtop[12][15] = 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,-1/3,-1/3,1,-1/3,1,-1/3,-1/3,-1/3,1,-1/3,-1/3,-1/3,1,-1/3, 1,-1/3,1,-1/3,-1/3,-1/3,1,-1/3,-1/3,1,-1/3,-1/3,1,-1/3,-1/3, 1,1,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,1,1,1,-1/3,-1/3,-1/3,-1/3, 1,-1/3,-1/3,-1/3,1/3,-1/3,-1/3,1/3,-1/3,1,-1/3,1/3,-1/3,-1/3,1/3, 1,-1/3,1,-1/3,-1/3,1,-1/3,-1/3,1,-1/3,-1/3,1,-1/3,-1/3,-1/3, 1,1,-1/3,-1/3,-1/3,1,1,1,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3, 1,-1/3,-1/3,-1/3,1/3,1,-1/3,-1/3,-1/3,-1/3,1/3,-1/3,1/3,-1/3,1/3, 1,1,1,1,1,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3, 1,-1/3,-1/3,5/21,1/21,-1/3,5/21,1/21,5/21,-1/3,1/21,1/21,1/21,1/21,-1/7, 1,-1/3,1,-1/3,-1/3,-1/3,-1/3,1/3,-1/3,-1/3,1/3,-1/3,-1/3,1/3,1/3, 1,1,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,-1/3,1/3,1/3,1/3,1/3; ideal Fourier = qtop*transpose(maxideal(1)); // This is the list of polynomial invariants. map F = rQ, Fourier; ideal PInvariants = F(Invariants); // This is the polynomial parametrization. ring r = 0,(a0,a1,b0,b1,c0,c1,d0,d1),dp; ideal P = a0*b0*c0*d0+3*a1*b1*c1*d1, 3*a0*b1*c0*d0+3*a1*b0*c1*d1+6*a1*b1*c1*d1, 3*a0*b0*c0*d1+3*a1*b1*c1*d0+6*a1*b1*c1*d1, 3*a0*b1*c0*d1+3*a1*b0*c1*d0+6*a1*b1*c1*d1, 6*a0*b1*c0*d1+6*a1*b0*c1*d1+6*a1*b1*c1*d0+6*a1*b1*c1*d1, 3*a0*b0*c1*d0+3*a1*b1*c0*d1+6*a1*b1*c1*d1, 3*a0*b1*c1*d0+3*a1*b0*c0*d1+6*a1*b1*c1*d1, 6*a0*b1*c1*d0+6*a1*b0*c1*d1+6*a1*b1*c0*d1+6*a1*b1*c1*d1, 3*a0*b0*c1*d1+3*a1*b1*c0*d0+6*a1*b1*c1*d1, 3*a0*b1*c1*d1+3*a1*b0*c0*d0+6*a1*b1*c1*d1, 6*a0*b1*c1*d1+6*a1*b0*c1*d1+6*a1*b1*c0*d0+6*a1*b1*c1*d1, 6*a0*b0*c1*d1+6*a1*b1*c0*d1+6*a1*b1*c1*d0+6*a1*b1*c1*d1, 6*a0*b1*c1*d1+6*a1*b0*c0*d1+6*a1*b1*c1*d0+6*a1*b1*c1*d1, 6*a0*b1*c1*d1+6*a1*b0*c1*d0+6*a1*b1*c0*d1+6*a1*b1*c1*d1, 6*a0*b1*c1*d1+6*a1*b0*c1*d1+6*a1*b1*c0*d1+6*a1*b1*c1*d0; // This checks that the polynomial parametrization // lies on the probability simplex. // It requires suma.sing. Most likely, you should // change the directory where you saved this file. // If you do have this file, you should uncomment // the following two lines. // < "/home/lgp/singular/suma.sing"; // Suma(Substitute(1,P)); // This checks that the PInvariants vanish at // the polynomial parametrization. map Evaluate = rP, P; // The following command takes a lot of space and time to // finish for larger models. // ideal Z = Evaluate(PInvariants); setring rP; ideal Z; int i; for (i=1; i<= size(PInvariants); i++) { i; Z = PInvariants[i]; setring r; Evaluate(Z); setring rP; }