//This is the ideal Fourier invariants. ring rQ = 0,(q1,q2,q3,q4,q5,q6,q7),dp; ideal Invariants = q2*q5*q6-q3*q4*q7, q2*q4*q6-q1*q5*q7, q3*q4^2-q1*q5^2, q2^2*q6^2-q1*q3*q7^2; // This is the inverse of the Fourier transform. matrix ptoq[7][7] = 1/16,1/8,1/16,1/4,1/4,1/8,1/8, 1/4,0,-1/4,1/2,-1/2,0,0, 1/8,-1/4,1/8,0,0,1/4,-1/4, 1/8,1/4,1/8,0,0,-1/4,-1/4, 1/4,0,-1/4,-1/2,1/2,0,0, 1/8,-1/4,1/8,0,0,-1/4,1/4, 1/16,1/8,1/16,-1/4,-1/4,1/8,1/8; // This is the ring of probability distributions. ring rP = 0,(p1,p2,p3,p4,p5,p6,p7),dp; //This is the Fourier transform. matrix qtop[7][7] = 1,1,1,1,1,1,1, 1,0,-1,1,0,-1,1, 1,-1,1,1,-1,1,1, 1,1/2,0,0,-1/2,0,-1, 1,-1/2,0,0,1/2,0,-1, 1,0,1,-1,0,-1,1, 1,0,-1,-1,0,1,1; 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,(b0,b1,b2,d0,d1,d2),dp; ideal P = b0^2*d0^3+2*b0^2*d1^3+b0^2*d2^3+4*b0*b1*d0^2*d1+4*b0*b1*d0*d1^2+4*b0*b1*d1^2*d2+4*b0*b1*d1*d2^2+2*b0*b2*d0^2*d2+2*b0*b2*d0*d2^2+4*b0*b2*d1^3+2*b1^2*d0^3+2*b1^2*d0^2*d2+2*b1^2*d0*d2^2+8*b1^2*d1^3+2*b1^2*d2^3+4*b1*b2*d0^2*d1+4*b1*b2*d0*d1^2+4*b1*b2*d1^2*d2+4*b1*b2*d1*d2^2+b2^2*d0^3+2*b2^2*d1^3+b2^2*d2^3, 4*b0^2*d0^2*d1+4*b0^2*d0*d1^2+4*b0^2*d1^2*d2+4*b0^2*d1*d2^2+8*b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d0*d1*d2+4*b0^2*d1^2*d2+8*b0*b1*d0^2*d1+16*b0*b1*d0*d1^2+16*b0*b1*d0*d1*d2+16*b0*b1*d1^2*d2+8*b0*b1*d1*d2^2+8*b0*b2*d0^2*d1+8*b0*b2*d0*d1^2+8*b0*b2*d1^2*d2+8*b0*b2*d1*d2^2+8*b1^2*d0^2*d1+16*b1^2*d0*d1^2+16*b1^2*d0*d1*d2+16*b1^2*d1^2*d2+8*b1^2*d1*d2^2+8*b1*b2*d0^2*d1+16*b1*b2*d0*d1^2+16*b1*b2*d0*d1*d2+16*b1*b2*d1^2*d2+8*b1*b2*d1*d2^2+4*b2^2*d0*d1^2+8*b2^2*d0*d1*d2+4*b2^2*d1^2*d2, 2*b0^2*d0*d1^2+4*b0^2*d0*d1*d2+2*b0^2*d1^2*d2+8*b0*b1*d0^2*d2+8*b0*b1*d0*d2^2+16*b0*b1*d1^3+4*b0*b2*d0*d1^2+8*b0*b2*d0*d1*d2+4*b0*b2*d1^2*d2+8*b1^2*d0*d1^2+16*b1^2*d0*d1*d2+8*b1^2*d1^2*d2+8*b1*b2*d0^2*d2+8*b1*b2*d0*d2^2+16*b1*b2*d1^3+2*b2^2*d0*d1^2+4*b2^2*d0*d1*d2+2*b2^2*d1^2*d2, b0^2*d0^2*d2+b0^2*d0*d2^2+2*b0^2*d1^3+4*b0*b1*d0^2*d1+4*b0*b1*d0*d1^2+4*b0*b1*d1^2*d2+4*b0*b1*d1*d2^2+2*b0*b2*d0^3+4*b0*b2*d1^3+2*b0*b2*d2^3+2*b1^2*d0^3+2*b1^2*d0^2*d2+2*b1^2*d0*d2^2+8*b1^2*d1^3+2*b1^2*d2^3+4*b1*b2*d0^2*d1+4*b1*b2*d0*d1^2+4*b1*b2*d1^2*d2+4*b1*b2*d1*d2^2+b2^2*d0^2*d2+b2^2*d0*d2^2+2*b2^2*d1^3; // 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(2,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; }