//This is the ideal Fourier invariants. ring rQ = 0,(q1,q2,q3,q4,q5,q6,q7),dp; ideal Invariants = q5*q6-q4*q7, q4*q6-q3*q7, q4^2-q3*q5, q2*q3-q1*q5, q4^2*q5-q2*q7^2, q4^3-q2*q6*q7, q3*q4^2-q2*q6^2, q3*q4^2-q1*q7^2, q3^2*q4-q1*q6*q7, q3^3-q1*q6^2; // This is the inverse of the Fourier transform. matrix ptoq[9][7] = 1/64,3/64,15/64,3/16,9/64,3/16,3/16, 3/32,-3/32,21/32,-3/8,-9/32,3/8,-3/8, 3/64,9/64,-3/64,-3/16,27/64,-3/16,-3/16, 3/32,-3/32,-3/32,3/8,-9/32,-3/8,3/8, 3/32,9/32,9/32,3/8,-9/32,-3/8,-3/8, 3/32,-3/32,9/32,-3/8,3/32,-3/8,3/8, 3/8,-3/8,-3/8,0,3/8,0,0, 3/32,9/32,-15/32,-3/8,-9/32,3/8,3/8, 3/32,-3/32,-15/32,3/8,3/32,3/8,-3/8; // This is the ring of probability distributions. ring rP = 0,(p1,p2,p3,p4,p5,p6,p7,p8,p9),dp; //This is the Fourier transform. matrix qtop[7][9] = 1,1,1,1,1,1,1,1,1, 1,-1/3,1,-1/3,1,-1/3,-1/3,1,-1/3, 1,7/15,-1/15,-1/15,1/5,1/5,-1/15,-1/3,-1/3, 1,-1/3,-1/3,1/3,1/3,-1/3,0,-1/3,1/3, 1,-1/3,1,-1/3,-1/3,1/9,1/9,-1/3,1/9, 1,1/3,-1/3,-1/3,-1/3,-1/3,0,1/3,1/3, 1,-1/3,-1/3,1/3,-1/3,1/3,0,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,(c0,c1,e0,e1),dp; ideal P = c0^3*e0^4+3*c0^3*e1^4+6*c0^2*c1*e0^3*e1+6*c0^2*c1*e0^2*e1^2+6*c0^2*c1*e0*e1^3+18*c0^2*c1*e1^4+6*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276*c0*c1^2*e0*e1^3+204*c0*c1^2*e1^4+12*c1^3*e0^3*e1+144*c1^3*e0^2*e1^2+324*c1^3*e0*e1^3+168*c1^3*e1^4; // 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; }