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