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