"""Singular input independent_section3.sing, embedded verbatim. Hexagon accepts only certain script types in anc/, so the Singular input is stored here as a string. Run python3 independent_section3_singular.py to write independent_section3.sing next to this file and run it with Singular (executable `Singular` on PATH), or pass --write-only to only write the .sing file. """ import os, subprocess, sys SINGULAR_INPUT = 'ring r=0,(x0,x1,x2,x3,x4,x5,U,V,A,B,C,z),dp;\npoly D=x0*x3*x5-x0*x4^2-x1^2*x5+2*x1*x2*x4-x2^2*x3;\npoly W=x0^4+x0^3*x1-x0^3*x2-2*x0^2*x3^2+16*x0*x1*x3*x5-7*x0*x2*x3^2+14*x0*x3*x4*x5-20*x0*x3*x5^2+8*x1*x5^3-7*x2*x3*x5^2+x3^4+x4*x5^3-x5^4;\nmap ch=r,1,U,V,U^2+A,U*V+B,V^2+C,U,V,A,B,C,z;\nmap zero=r,x0,x1,x2,x3,x4,x5,U,V,0,0,0,z;\npoly Wch=ch(W);\npoly H=resultant(z^8-z-1,z^2+V*z+U,z);\npoly aa=4*U^6-14*U^2*V-4*U^2+14*U*V^3+16*U*V^2-7*V^5-20*V^4;\npoly bb=14*U^2*V^2+V^6;\npoly cc=14*U^3*V+16*U^3-14*U^2*V^3-40*U^2*V^2+3*U*V^5+24*U*V^4-4*V^6;\npoly Vzero=-231*U^6+1169/2*U^2*V+215*U^2-833/2*U*V^3-988*U*V^2+1/4*V^5+411*V^4;\npoly Vsharp=-231*x3^3+1169/2*x0*x2*x3+215*x0^2*x3-833/2*x0*x4*x5-988*x0*x1*x5+1/4*x2*x5^2+411*x0*x5^2;\npoly rzero=U^4-6*U^3*V^2+5*U^2*V^4-U*V^6-1;\npoly rone=4*U^3*V-10*U^2*V^3+6*U*V^5-V^7-1;\nideal relations=rzero,rone;\nideal gb=std(relations);\nprint("Chart determinant remainder:"); print(ch(D)-(A*C-B^2));\nprint("W restricted minus resultant:"); print(zero(Wch)-H);\npoly da=diff(Wch,A); poly db=diff(Wch,B); poly dc=diff(Wch,C);\nprint("Normal partial remainders:"); print(zero(da)-aa); print(zero(db)-bb); print(zero(dc)-cc);\npoly Vsch=ch(Vsharp);\nprint("Vsharp restriction remainder:"); print(zero(Vsch)-Vzero);\nprint("Vzero - K normal form:"); print(reduce(Vzero-aa*cc+(bb^2)/4,gb));\nprint("H, HU, HV normal forms:"); print(reduce(H,gb)); print(reduce(diff(H,U),gb)); print(reduce(diff(H,V),gb));\npoly detH=diff(diff(H,U),U)*diff(diff(H,V),V)-diff(diff(H,U),V)^2;\nideal check=relations,detH;\nprint("Ideal (r0,r1,detH) is unit ideal:"); print(std(check));\nquit;\n' here = os.path.dirname(os.path.abspath(__file__)) path = os.path.join(here, "independent_section3.sing") with open(path, "w", encoding="utf-8") as f: f.write(SINGULAR_INPUT) if "--write-only" not in sys.argv: subprocess.run(["Singular", "-q", path], check=True)