# Code to check the expressions of the invariants $$I_4,I_{8},I_{12},I_{18}$$ in terms of $$j_2, j_3,j_5, j_6, j_9$$¶

:

from sage.rings.invariants.invariant_theory import AlgebraicForm,transvectant

_.<b0, b1, b2, b3, b4, b5, c0, c1, mu1, mu2, t1, t2, x, y> = QQ[]

def quinticAsFourOneInvariantsCoeffs():

q = b0 * x^4 + b1 * x^3*y^1 + b2 * x^2*y^2 + b3 * x*y^3 + b4 * y^4

l = c0 * x + c1 * y

p = q*l

qDelta = p(b0, b1, b2, b3, b4, b5, c0, c1, mu1, mu2, t1, t2, x, 1)
Delta = qDelta.discriminant(x) # the discriminant

q4 = p^2
f4 = AlgebraicForm(2, 10, q4, x, y)
T4 = transvectant(f4, f4, 10, scale='none')
I4 = T4.polynomial() # the invariant I4

q8 = p^4
f8 = AlgebraicForm(2, 20, q8, x, y)
T8 = transvectant(f8, f8, 20, scale='none')
I8 = T8.polynomial() # the invariant I8

q12 = p^6
f12 = AlgebraicForm(2, 30, q12, x, y)
T12 = transvectant(f12, f12, 30, scale='none')
I12 = T12.polynomial() # the invariant I12

q18_1, q18_2, q18_3 = p^5, p^6, p^7
f18_1 = AlgebraicForm(2, 25, q18_1, x, y)
f18_2 = AlgebraicForm(2, 30, q18_2, x, y)
T18 = transvectant(f18_1, f18_2, 10, scale='none')
f18_3 = AlgebraicForm(2, 35, q18_3, x, y)
T18_1 = transvectant(f18_3, T18, 35, scale='none')
I18 = T18_1.polynomial() # the invariant I18

alpha = 1/(250822656000)
beta = 1/(299067455175152371993371049908040738485043200000000000000)

H = beta*I12 -  396*(alpha*I4)^3 # the invariant H

### Notice that we are scaling the invariants to make their coefficients coprime integers.

return [I4/41803776000,
I8/8543177208700379867381760000000,
I12/9062650156822799151314274239637598135910400000000000000,
I18/150029545764234105222267552311394127852252417928072743057133909444111892480000000000000000000,
Delta/1,
H/(1/22)]

def FourOneInvariantsCoeffs():

q = b0 * x^4 + b1 * x^3*y^1 + b2 * x^2*y^2 + b3 * x*y^3 + b4 * y^4

l = c0 * x + c1 * y

######### j2
fq = AlgebraicForm(2, 4, q, x, y)
T4 = transvectant(fq, fq, 4, scale='none')
j2=T4.polynomial()

######### j3
fq = AlgebraicForm(2, 4, q, x, y)

Tinitial1 = transvectant(fq,fq,2,scale='none')

Tinitial2 = transvectant(fq,Tinitial1,4,scale='none')

j3=Tinitial2.polynomial()

######### j5
fq = AlgebraicForm(2, 4, q, x, y)
gq = AlgebraicForm(2, 4, l^4, x, y)

Tinitial1 = transvectant(gq,fq,4,scale='none')
j5 = Tinitial1.polynomial()

######### j6
fq = AlgebraicForm(2, 4, q, x, y)
gq = AlgebraicForm(2, 4, l^4, x, y)

Tinitial1 = transvectant(fq,fq,2,scale='none')
Tinitial2 = transvectant(gq,Tinitial1,4,scale='none')

j6=Tinitial2.polynomial()

######### j9
fq = AlgebraicForm(2, 4, q, x, y)
gq = AlgebraicForm(2, 6, l^6, x, y)

Tinitial1 = transvectant(fq, fq, 2, scale='none')

Tinitial2 = transvectant(fq, Tinitial1, 1, scale='none')

Tinitial3 = transvectant(Tinitial2, gq, 6, scale='none')

j9 = Tinitial3.polynomial()

return [j2/96, j3/1152, j5/576, j6/3456, j9/37324800]

:

j2, j3, j5, j6, j9 = FourOneInvariantsCoeffs()

I4,I8,I12,I18,Delta,H = quinticAsFourOneInvariantsCoeffs()

print("\n\n")
print("I4 - 2j2/3")
print(I4 - ( 2*j2*j6  - j3*j5 ) / 3 )

print("\n\n")
print("I8 - (14/9)*j2^2*j6^2 - (22/27)*j2^3*j5^2 - (5/27)*j3^2*j5^2 + (14/9)*j2*j3*j5*j6")
print(I8 - (14/9)*j2^2*j6^2 - (22/27)*j2^3*j5^2 - (5/27)*j3^2*j5^2 + (14/9)*j2*j3*j5*j6)

print("\n\n")
print("I12 - ( (4400/243)*j2^3*j6^3  - (11/243)*j3^2*j6^3 - (242/9)*j2^2*j3*j5*j6^2 + (2479/81)*j2^4*j5^2*j6 + (692/81)*j2*j3^2*j5^2*j6 - (7156/243)*j2^3*j3*j5^3 - (92/243)*j3^3*j5^3  )")
D12 = I12 - ( (4400/243)*j2^3*j6^3  - (11/243)*j3^2*j6^3 - (242/9)*j2^2*j3*j5*j6^2 + (2479/81)*j2^4*j5^2*j6 + (692/81)*j2*j3^2*j5^2*j6 - (7156/243)*j2^3*j3*j5^3 - (92/243)*j3^3*j5^3  )
print(D12)

print("\n\n")
print("I18 - ( (-625/729)*j2^6*j5^3*j9  + (-512/729)*j2^3*j3^2*j5^3*j9 + (-4/729)*j2^3*j3*j6^3*j9 + (1/729)*j3^3*j6^3*j9 + (1/3)*j2^4*j3*j5^2*j6*j9 +  (4/243)*j2^5*j5*j6^2*j9 + (-1/243)*j2^2*j3^2*j5*j6^2*j9  )")
D18 = I18 - ( (-625/729)*j2^6*j5^3*j9  + (-512/729)*j2^3*j3^2*j5^3*j9 + (-4/729)*j2^3*j3*j6^3*j9 + (1/729)*j3^3*j6^3*j9 + (1/3)*j2^4*j3*j5^2*j6*j9 +  (4/243)*j2^5*j5*j6^2*j9 + (-1/243)*j2^2*j3^2*j5*j6^2*j9  )
print(D18)



I4 - 2j2/3
0

I8 - (14/9)*j2^2*j6^2 - (22/27)*j2^3*j5^2 - (5/27)*j3^2*j5^2 + (14/9)*j2*j3*j5*j6
0

I12 - ( (4400/243)*j2^3*j6^3  - (11/243)*j3^2*j6^3 - (242/9)*j2^2*j3*j5*j6^2 + (2479/81)*j2^4*j5^2*j6 + (692/81)*j2*j3^2*j5^2*j6 - (7156/243)*j2^3*j3*j5^3 - (92/243)*j3^3*j5^3  )
0

I18 - ( (-625/729)*j2^6*j5^3*j9  + (-512/729)*j2^3*j3^2*j5^3*j9 + (-4/729)*j2^3*j3*j6^3*j9 + (1/729)*j3^3*j6^3*j9 + (1/3)*j2^4*j3*j5^2*j6*j9 +  (4/243)*j2^5*j5*j6^2*j9 + (-1/243)*j2^2*j3^2*j5*j6^2*j9  )
0