//This is the ideal Fourier invariants. ring rQ = 0,(q1,q2,q3,q4,q5,q6,q7,q8,q9),dp; ideal Invariants = q7*q8-q6*q9, q6*q8-q5*q9, q4*q7-q3*q9, q6^2-q5*q7, q6^2-q4*q9, q5*q6-q4*q8, q4*q6-q3*q8, q4*q6-q2*q9, q3*q6-q2*q7, q4*q5-q2*q8, q4^2-q3*q5, q4^2-q2*q6, q3*q4-q1*q9, q2*q4-q1*q8, q3^2-q1*q7, q2*q3-q1*q6, q2^2-q1*q5; // This is the inverse of the Fourier transform. matrix ptoq[10][9] = 1/256,5/64,5/128,15/64,5/32,15/64,5/256,5/32,5/64, 5/128,15/32,5/64,15/32,5/16,-15/32,-15/128,-5/16,-15/32, 5/256,5/64,25/128,15/64,-15/32,15/64,25/256,-15/32,5/64, 5/64,5/8,-5/32,-15/16,0,0,5/64,0,5/16, 5/32,0,5/16,0,-5/4,0,-15/32,5/4,0, 5/64,5/16,-5/32,0,0,-15/16,5/64,0,5/8, 5/128,-5/32,25/64,-15/32,5/16,-15/32,25/128,5/16,-5/32, 15/64,0,-15/32,-15/16,0,15/8,15/64,0,-15/16, 15/128,-15/32,15/64,-15/32,15/16,15/32,-45/128,-15/16,15/32, 15/64,-15/16,-15/32,15/8,0,-15/16,15/64,0,0; // This is the ring of probability distributions. ring rP = 0,(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10),dp; //This is the Fourier transform. matrix qtop[9][10] = 1,1,1,1,1,1,1,1,1,1, 1,3/5,1/5,2/5,0,1/5,-1/5,0,-1/5,-1/5, 1,1/5,1,-1/5,1/5,-1/5,1,-1/5,1/5,-1/5, 1,1/5,1/5,-1/5,0,0,-1/5,-1/15,-1/15,2/15, 1,1/5,-3/5,0,-1/5,0,1/5,0,1/5,0, 1,-1/5,1/5,0,0,-1/5,-1/5,2/15,1/15,-1/15, 1,-3/5,1,1/5,-3/5,1/5,1,1/5,-3/5,1/5, 1,-1/5,-3/5,0,1/5,0,1/5,0,-1/5,0, 1,-3/5,1/5,1/5,0,2/5,-1/5,-1/5,1/5,0; 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,(e0,e1,e2),dp; ideal P = e0^5+2*e1^5+e2^5, 10*e0^4*e1+10*e0*e1^4+10*e1^4*e2+10*e1*e2^4, 5*e0^4*e2+5*e0*e2^4+10*e1^5, 20*e0^3*e1^2+20*e0^2*e1^3+20*e1^3*e2^2+20*e1^2*e2^3, 40*e0^3*e1*e2+40*e0*e1^4+40*e0*e1*e2^3+40*e1^4*e2, 20*e0^3*e1^2+40*e0*e1^3*e2+20*e1^2*e2^3, 10*e0^3*e2^2+10*e0^2*e2^3+20*e1^5, 60*e0^2*e1^3+60*e0^2*e1^2*e2+60*e0*e1^2*e2^2+60*e1^3*e2^2, 60*e0^2*e1*e2^2+30*e0*e1^4+30*e1^4*e2, 60*e0^2*e1^2*e2+120*e0*e1^3*e2+60*e0*e1^2*e2^2; // 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; }