restart; with(LinearAlgebra): # Define indeterminates QParam := [q1,q2,q3,q4]: PParam := Matrix([[p1],[p2],[p3],[p4]]): # Special Fourier parameterization and inverse F := Matrix([ [1,1,1,1], [1,-1/3,1,-1/3], [1,1/3,-1/3,-1/3], [1,-1/3,-1/3,1/3]]): FI := Matrix([ [1/16,3/16,3/8,3/8], [3/8,-3/8,3/4,-3/4], [3/16,9/16,-3/8,-3/8], [3/8,-3/8,-3/4,3/4]]): # List of polynomial parametrizations P0 := [ b0^2*d0^3+3*b0^2*d1^3+6*b0*b1*d0^2*d1+6*b0*b1*d0*d1^2+12*b0*b1*d1^3+3*b1^2*d0^3+6*b1^2*d0^2*d1+6*b1^2*d0*d1^2+21*b1^2*d1^3, 6*b0^2*d0^2*d1+6*b0^2*d0*d1^2+12*b0^2*d1^3+12*b0*b1*d0^2*d1+84*b0*b1*d0*d1^2+48*b0*b1*d1^3+30*b1^2*d0^2*d1+102*b1^2*d0*d1^2+84*b1^2*d1^3, 3*b0^2*d0^2*d1+3*b0^2*d0*d1^2+6*b0^2*d1^3+6*b0*b1*d0^3+12*b0*b1*d0^2*d1+12*b0*b1*d0*d1^2+42*b0*b1*d1^3+6*b1^2*d0^3+21*b1^2*d0^2*d1+21*b1^2*d0*d1^2+60*b1^2*d1^3, 18*b0^2*d0*d1^2+6*b0^2*d1^3+24*b0*b1*d0^2*d1+60*b0*b1*d0*d1^2+60*b0*b1*d1^3+24*b1^2*d0^2*d1+114*b1^2*d0*d1^2+78*b1^2*d1^3]: # Substitutions based on the model P := P0: P := subs(b0 = 1-3*b1, P): P := subs(d0 = 1-3*d1, 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([ q2*q3^2-q1*q4^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: