restart; with(LinearAlgebra): # Define indeterminates QParam := [q1,q2,q3,q4,q5,q6]: PParam := Matrix([[p1],[p2],[p3],[p4],[p5],[p6],[p7]]): # Special Fourier parameterization and inverse F := Matrix([ [1,1,1,1,1,1,1], [1,1/9,1/9,-1/3,1,1/9,-1/3], [1,-1/3,-1/3,1/3,1,-1/3,1/3], [1,5/9,1/9,1/9,-1/3,-1/3,-1/3], [1,1/9,-1/3,-1/9,-1/3,1/9,1/3], [1,-1/3,5/21,1/21,-1/3,1/21,-1/7]]): FI := Matrix([ [1/64,9/64,3/32,9/64,9/32,21/64], [9/64,9/64,-9/32,45/64,9/32,-63/64], [9/64,9/64,-9/32,9/64,-27/32,45/64], [9/32,-27/32,9/16,9/32,-9/16,9/32], [3/64,27/64,9/32,-9/64,-9/32,-21/64], [9/32,9/32,-9/16,-27/32,9/16,9/32], [3/32,-9/32,3/16,-9/32,9/16,-9/32]]): # List of polynomial parametrizations P0 := [ b0^2*e0^4+3*b0^2*e1^4+6*b0*b1*e0^3*e1+6*b0*b1*e0*e1^3+12*b0*b1*e1^4+3*b1^2*e0^4+6*b1^2*e0^3*e1+6*b1^2*e0*e1^3+21*b1^2*e1^4, 9*b0^2*e0^3*e1+9*b0^2*e0*e1^3+18*b0^2*e1^4+72*b0*b1*e0^2*e1^2+72*b0*b1*e0*e1^3+72*b0*b1*e1^4+27*b1^2*e0^3*e1+72*b1^2*e0^2*e1^2+99*b1^2*e0*e1^3+126*b1^2*e1^4, 18*b0^2*e0^2*e1^2+18*b0^2*e1^4+18*b0*b1*e0^3*e1+36*b0*b1*e0^2*e1^2+90*b0*b1*e0*e1^3+72*b0*b1*e1^4+18*b1^2*e0^3*e1+90*b1^2*e0^2*e1^2+90*b1^2*e0*e1^3+126*b1^2*e1^4, 18*b0^2*e0^2*e1^2+36*b0^2*e0*e1^3+18*b0^2*e1^4+72*b0*b1*e0^2*e1^2+288*b0*b1*e0*e1^3+72*b0*b1*e1^4+126*b1^2*e0^2*e1^2+396*b1^2*e0*e1^3+126*b1^2*e1^4, 3*b0^2*e0^3*e1+3*b0^2*e0*e1^3+6*b0^2*e1^4+6*b0*b1*e0^4+12*b0*b1*e0^3*e1+12*b0*b1*e0*e1^3+42*b0*b1*e1^4+6*b1^2*e0^4+21*b1^2*e0^3*e1+21*b1^2*e0*e1^3+60*b1^2*e1^4, 18*b0^2*e0^2*e1^2+36*b0^2*e0*e1^3+18*b0^2*e1^4+36*b0*b1*e0^3*e1+108*b0*b1*e0^2*e1^2+108*b0*b1*e0*e1^3+180*b0*b1*e1^4+36*b1^2*e0^3*e1+162*b1^2*e0^2*e1^2+216*b1^2*e0*e1^3+234*b1^2*e1^4, 24*b0^2*e0*e1^3+36*b0*b1*e0^2*e1^2+72*b0*b1*e0*e1^3+36*b0*b1*e1^4+36*b1^2*e0^2*e1^2+144*b1^2*e0*e1^3+36*b1^2*e1^4]: # Substitutions based on the model P := P0: P := subs(b0 = 1-3*b1, P): P := subs(e0 = 1-3*e1, P): # Check that the polynomial parametrization lies in the probability simplex suma := 0: for i from 1 to nops(P) do suma := suma + P[i]: od: normal(expand(suma)); # Ideal of Invariants in Fourier coordinates Invariants := Matrix([ q5^2-q4*q6, q3*q5-q2*q6, q3*q4-q2*q5, q2*q4-q1*q6, q2^3-q1*q3^2]): # Ideal of Invariants in probability coordinates Fourier := MatrixMatrixMultiply(F,PParam): PInvariants := Invariants: for i from 1 to nops(QParam) do PInvariants := subs(QParam[i] = Fourier[i, 1], PInvariants): od: # Evaluation of Invariants at the polynomial/rational parametrization num := op(PInvariants[1,1..-1])[1]: for j from 1 to num do coordpoly := PInvariants[1, j]: for i from 1 to op(PParam[1..-1,1])[1] do coordpoly := subs(PParam[i, 1] = P0[i], coordpoly): od: coordpoly :=expand(coordpoly): lprint(j,coordpoly); od: