Esempio n. 1
0
    def test__qmat__qpol(self):
        x = MARing.x()
        q = MARing.q()

        g_lst = DSegre.get_ideal_lst()
        chk_qpol = 0
        for i in range(len(g_lst)):
            chk_qpol += q[i] * g_lst[i]

        qmat = DSegre.get_qmat()
        qpol = list(sage_vector(x).row() * qmat *
                    sage_vector(x).column())[0][0]
        assert qpol == chk_qpol
Esempio n. 2
0
    def test__get_aut_P8__moduli(self):

        a, b, c, d, e, f, g, h = ring('a, b, c, d, e, f, g, h')
        M = DSegre.get_aut_P8([a, b, c, d, e, f, g, h])

        print(M)

        x = ring('[x0, x1, x2, x3, x4, x5, x6, x7, x8]')
        y = ring('[y0, y1, y2, y3, y4, y5, y6, y7, y8]')
        My = M * sage_vector(y)
        dct = {x[i]: My[i] for i in range(9)}

        pol = ring('x0^2-x1*x2')
        print(pol.subs(dct))

        # We may use this to check the dimension of the moduli space
        # of invariant quadratic forms, since coefficients of some of the
        # terms are necessarily 0.
        #
        chk = ''
        chk += '(b^2*c^2*f^2*g^2 - 2*a*b*c*d*f^2*g^2 + a^2*d^2*f^2*g^2 + 2*b^2*c^2*e*f*g*h - 4*a*b*c*d*e*f*g*h + 2*a^2*d^2*e*f*g*h + b^2*c^2*e^2*h^2 - 2*a*b*c*d*e^2*h^2 + a^2*d^2*e^2*h^2 )*y0^2  + '
        chk += '(-b^2*c^2*f^2*g^2 + 2*a*b*c*d*f^2*g^2 - a^2*d^2*f^2*g^2 - 2*b^2*c^2*e*f*g*h + 4*a*b*c*d*e*f*g*h - 2*a^2*d^2*e*f*g*h - b^2*c^2*e^2*h^2 + 2*a*b*c*d*e^2*h^2 - a^2*d^2*e^2*h^2)*y1*y2 + '
        chk += '(2*b^2*c^2*e*f*g*h - 4*a*b*c*d*e*f*g*h + 2*a^2*d^2*e*f*g*h                                                                                                                 )*y3*y4 + '
        chk += '(-b^2*c^2*e*f*g*h + 2*a*b*c*d*e*f*g*h - a^2*d^2*e*f*g*h                                                                                                                    )*y5*y6 + '
        chk += '(-b^2*c^2*e*f*g*h + 2*a*b*c*d*e*f*g*h - a^2*d^2*e*f*g*h                                                                                                                    )*y7*y8 + '
        chk += '(b^2*c^2*e^2*g^2 - 2*a*b*c*d*e^2*g^2 + a^2*d^2*e^2*g^2                                                                                                                     )*y3^2  + '
        chk += '(b^2*c^2*f^2*h^2 - 2*a*b*c*d*f^2*h^2 + a^2*d^2*f^2*h^2                                                                                                                     )*y4^2  + '
        chk += '(2*b^2*c^2*e*f*g^2 - 4*a*b*c*d*e*f*g^2 + 2*a^2*d^2*e*f*g^2 + 2*b^2*c^2*e^2*g*h - 4*a*b*c*d*e^2*g*h + 2*a^2*d^2*e^2*g*h                                                     )*y0*y3 + '
        chk += '(2*b^2*c^2*f^2*g*h - 4*a*b*c*d*f^2*g*h + 2*a^2*d^2*f^2*g*h + 2*b^2*c^2*e*f*h^2 - 4*a*b*c*d*e*f*h^2 + 2*a^2*d^2*e*f*h^2                                                     )*y0*y4 + '
        chk += '(-b^2*c^2*e*f*g^2 + 2*a*b*c*d*e*f*g^2 - a^2*d^2*e*f*g^2 - b^2*c^2*e^2*g*h + 2*a*b*c*d*e^2*g*h - a^2*d^2*e^2*g*h                                                            )*y2*y5 + '
        chk += '(-b^2*c^2*f^2*g*h + 2*a*b*c*d*f^2*g*h - a^2*d^2*f^2*g*h - b^2*c^2*e*f*h^2 + 2*a*b*c*d*e*f*h^2 - a^2*d^2*e*f*h^2                                                            )*y1*y6 + '
        chk += '(-b^2*c^2*f^2*g*h + 2*a*b*c*d*f^2*g*h - a^2*d^2*f^2*g*h - b^2*c^2*e*f*h^2 + 2*a*b*c*d*e*f*h^2 - a^2*d^2*e*f*h^2                                                            )*y2*y7 + '
        chk += '(-b^2*c^2*f^2*h^2 + 2*a*b*c*d*f^2*h^2 - a^2*d^2*f^2*h^2                                                                                                                    )*y6*y7 + '
        chk += '(-b^2*c^2*e*f*g^2 + 2*a*b*c*d*e*f*g^2 - a^2*d^2*e*f*g^2 - b^2*c^2*e^2*g*h + 2*a*b*c*d*e^2*g*h - a^2*d^2*e^2*g*h                                                            )*y1*y8 + '
        chk += '(-b^2*c^2*e^2*g^2 + 2*a*b*c*d*e^2*g^2 - a^2*d^2*e^2*g^2                                                                                                                    )*y5*y8   '

        assert pol.subs(dct) == ring(chk)
Esempio n. 3
0
    def get_invariant_qf(c_lst_lst, exc_idx_lst=[]):
        '''
        Computes quadratic forms in the ideal of the
        double Segre surface that are invariant under
        a given subgroup of Aut(P^1xP^1). 
        
        Parameters
        ----------        
        c_lst_lst : list<list<MARing.FF>>  
            A list of "c_lst"-lists.
            A c_lst is a list of length 8 with elements 
            c0,...,c7 in QQ(k), 
            where QQ(k) is a subfield of "MARing.FF".
            If we substitute k:=0 in the entries of 
            "c_lst" then we should obtain the list:
                [1,0,0,1,1,0,0,1].                                                                      
            A c_lst represents a pair of two matrices:                                
                ( [ c0 c1 ]   [ c4 c5 ] ) 
                ( [ c2 c3 ] , [ c6 c7 ] )                                   
            with the property that 
                c0*c3-c1*c2!=0 and c4*c7-c5*c6!=0.
            If the two matrices are not normalized
            to have determinant 1 then the method should be 
            taken with care (it should be checked that the
            tangent vectors at the identity generate the 
            correct Lie algebra).                                             
        
        exc_idx_lst : list<int>
            A list of integers in [0,8].                                     
        
        Returns
        -------
        A list of quadratic forms in the ideal of (a projection of) 
        the double Segre surface S:
            ".get_ideal_lst( exc_idx_lst )"
        such that the quadratic forms are invariant 
        under the automorphisms of S as defined by "c_lst_lst"
        and such that the quadratic forms generate the module of  
        all invariant quadratic forms. Note that Aut(S)=Aut(P^1xP^1).   
        '''

        # for verbose output
        #
        mt = MATools()
        sage_set_verbose(-1)

        # initialize vectors for indeterminates of "MARing.R"
        #
        x = MARing.x()
        q = MARing.q()
        r = MARing.r()

        # obtain algebraic conditions on q0,...,q19
        # so that the associated quadratic form is invariant
        # wrt. the automorphism defined by input "c_lst_lst"
        #
        iq_lst = []
        for c_lst in c_lst_lst:
            iq_lst += DSegre.get_invariant_q_lst(c_lst, exc_idx_lst)
        iq_lst = list(MARing.R.ideal(iq_lst).groebner_basis())

        # solve the ideal defined by "iq_lst"
        #
        sol_dct = MARing.solve(iq_lst, q)

        # substitute the solution in the quadratic form
        # associated to the symmetric matrix qmat.
        #
        qmat = DSegre.get_qmat(exc_idx_lst)
        qpol = list(sage_vector(x).row() * qmat *
                    sage_vector(x).column())[0][0]
        sqpol = qpol.subs(sol_dct)
        mt.p('sqpol   =', sqpol)
        mt.p('r       =', r)
        assert sqpol.subs({ri: 0 for ri in r}) == 0
        iqf_lst = []  # iqf=invariant quadratic form
        for i in range(len(r)):
            coef = sqpol.coefficient(r[i])
            if coef != 0:
                iqf_lst += [coef]
        mt.p('iqf_lst =', iqf_lst)

        return iqf_lst
Esempio n. 4
0
def usecase__horn_and_spindle_cyclides():
    '''    
    We consider the following cyclides with monomial
    parametrization determined by the following lattice 
    polygons:  
    
        [  *  ]           [  *  ]
        [* * *]           [  *  ]
        [  *  ]           [* * *]
        
     spindle cyclide    horn cyclide   
     leftright          leftright  
     (2,4,3)            (2,4,3)
       
    and 'leftright' involution act as a modular involution
    with vertical symmetry axis. We use the following numbering 
    (see DSegre.get_ideal_lst() and DSegre.change_basis()):
               
        [8 3 5]
        [2 0 1]
        [6 4 7]                
    '''
    if True:
        #
        # G-invariant quadratic forms for spindle cyclide
        # (see usecase__invariant_quadratic_forms('243ss')):
        #
        # x0^2 - x3*x4
        # x0^2 - x1^2 - x2^2
        #
        # We send x3 |--> a*(x4-x3)
        #         x4 |--> a*(x4+x3)
        #         where a=sqrt(1/2)
        # followed by sending: x4 |--> x0, x0 |--> x4

        a = ring('a')
        xv = x0, x1, x2, x3, x4 = ring('x0,x1,x2,x3,x4')
        y0, y1, y2, y3 = ring('y0,y1,y2,y3')
        m34 = sage_matrix(MARing.R,
                          [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
                           [0, 0, 0, -a, a], [0, 0, 0, a, a]])
        m04 = sage_matrix(MARing.R,
                          [[0, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
                           [0, 0, 0, 1, 0], [1, 0, 0, 0, 0]])
        m = m34 * m04
        v = sage_vector(xv)
        g1 = ring('x0^2 - x3*x4')
        g2 = ring('x0^2 - x1^2 - x2^2')
        mat1 = sage_invariant_theory.quadratic_form(
            g1, xv).as_QuadraticForm().matrix()
        mat2 = sage_invariant_theory.quadratic_form(
            g2, xv).as_QuadraticForm().matrix()
        ng1 = v.row() * m.T * mat1 * m * v.column()
        ng2 = v.row() * m.T * mat2 * m * v.column()
        G1 = sage_SR(str(ng1[0])).subs({sage_SR('a'): 1 / sage_sqrt(2)})
        G2 = sage_SR(str(ng2[0])).subs({sage_SR('a'): 1 / sage_sqrt(2)})

        S = sage_PolynomialRing(sage_QQ,
                                sage_var('x0,x1,x2,x3,x4,y0,y1,y2,y3'))
        x0, x1, x2, x3, x4, y0, y1, y2, y3 = S.gens()
        G1 = sage__eval(str(G1), S.gens_dict())
        G2 = sage__eval(str(G2), S.gens_dict())
        assert G1 in S
        assert G2 in S
        smap = [y0 - (x0 - x3), y1 - x1, y2 - x2, y3 - x4]
        prj_lst = S.ideal([G1, G2] + smap).elimination_ideal(
            [x0, x1, x2, x3, x4]).gens()
        eqn = str(prj_lst[0].subs({y0: 1})).replace('y1', 'x').replace(
            'y2', 'y').replace('y3', 'z')

        MATools.p(80 * '-')
        MATools.p('SPINDLE CYCLIDE')
        MATools.p(80 * '-')
        MATools.p('We define a projective automorphism m:P^4--->P^4')
        MATools.p('\t a   = 1/sqrt(2)')
        MATools.p('\t m34 =', list(m34))
        MATools.p('\t m04 =', list(m04))
        MATools.p('\t m = m34 * m04 =', list(m))
        MATools.p('\t det(m) =', m.det())
        MATools.p('\t v |--> m*v =', v, '|-->', m * v)
        MATools.p(
            'Generators of ideal of cyclide in quadric of signature [1,4]:')
        MATools.p('\t g1 =', g1)
        MATools.p('\t g2 =', g2)
        MATools.p('Generators of ideal of cyclide in S^3 after applying m:')
        MATools.p('\t G1 =', G1)
        MATools.p('\t G2 =', G2)
        MATools.p('\t G2-2*G1 =', G2 - 2 * G1)
        MATools.p('Stereographic projection to circular quadratic cone:')
        MATools.p('\t smap    =', smap, '(stereographic projection map)')
        MATools.p('\t prj_lst =', prj_lst)
        MATools.p('\t eqn     =', eqn)
        MATools.p(80 * '-' + 2 * '\n')

    if True:
        #
        # G-invariant quadratic forms for horn cyclides
        # (see usecase__invariant_quadratic_forms('243st')):
        #
        # x0^2 - x3*x4
        # x4^2 - x6^2 - x7^2
        #

        a = ring('a')
        xv = x0, x3, x4, x6, x7 = ring('x0,x3,x4,x6,x7')
        y0, y1, y2, y3 = ring('y0,y1,y2,y3')
        m = sage_matrix(MARing.R,
                        [[0, 0, a, 0, 0], [0, 1, 0, 0, 0], [-1, -1, 0, 0, 0],
                         [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]])
        v = sage_vector(xv)
        g1 = ring('x0^2 - x3*x4')
        g2 = ring('x4^2 - x6^2 - x7^2')
        mat1 = sage_invariant_theory.quadratic_form(
            g1, xv).as_QuadraticForm().matrix()
        mat2 = sage_invariant_theory.quadratic_form(
            g2, xv).as_QuadraticForm().matrix()
        ng1 = v.row() * m.T * mat1 * m * v.column()
        ng2 = v.row() * m.T * mat2 * m * v.column()
        G1 = sage_SR(str(ng1[0])).subs({sage_SR('a'): 1 / sage_sqrt(2)})
        G2 = sage_SR(str(ng2[0])).subs({sage_SR('a'): 1 / sage_sqrt(2)})

        S = sage_PolynomialRing(sage_QQ,
                                sage_var('x0,x3,x4,x6,x7,y0,y1,y2,y3'))
        x0, x3, x4, x6, x7, y0, y1, y2, y3 = S.gens()
        G1 = sage__eval(str(G1), S.gens_dict())
        G2 = sage__eval(str(G2), S.gens_dict())
        assert G1 in S
        assert G2 in S
        smap = [y0 - (x0 + x3), y1 - x4, y2 - x7, y3 - x6]
        prj_lst = S.ideal([G1, G2] + smap).elimination_ideal(
            [x0, x3, x4, x6, x7]).gens()
        eqn = str(prj_lst[0].subs({y0: 1})).replace('y1', 'x').replace(
            'y2', 'y').replace('y3', 'z')

        MATools.p(80 * '-')
        MATools.p('HORN CYCLIDE')
        MATools.p(80 * '-')
        MATools.p('We define a projective automorphism m:P^4--->P^4')
        MATools.p('\t a   = 1/sqrt(2)')
        MATools.p('\t m =', list(m))
        MATools.p('\t det(m) =', m.det())
        MATools.p('\t v |--> m*v =', v, '|-->', m * v)
        MATools.p(
            'Generators of ideal of cyclide in quadric of signature [1,4]:')
        MATools.p('\t g1 =', g1)
        MATools.p('\t g2 =', g2)
        MATools.p('Generators of ideal of cyclide in S^3 after applying m:')
        MATools.p('\t G1 =', G1)
        MATools.p('\t G2 =', G2)
        MATools.p('\t G2-2*G1 =', G2 - 2 * G1)
        MATools.p('Stereographic projection to circular cylinder:')
        MATools.p('\t smap    =', smap, '(stereographic projection map)')
        MATools.p('\t prj_lst =', prj_lst)
        MATools.p('\t eqn     =', eqn)
        MATools.p(80 * '-' + 2 * '\n')
Esempio n. 5
0
    def get_invariant_qf(c_lst_lst):
        '''
        Parameters
        ----------    
        c_lst_lst : list 
            A list of "c_lst"-lists.
            A c_lst is a list of length 9 with elements 
            c0,...,c8 in the subring in QQ(k)  of "MARing.FF". 
            The matrix                         
                [ c0 c1 c2 ]
            M = [ c3 c4 c5 ]
                [ c6 c7 c8 ]                                                         
            represents---for each value of k---an 
            automorphism of P^2. If we set k:=0 then 
            "c_lst" must correspond to the identity matrix: 
            [ 1,0,0, 0,1,0, 0,0,1 ]. If M is not normalized
            to have determinant 1 then the method should be 
            taken with care (see doc. ".get_c_lst_lst_dct").         
        
        Returns
        -------
        list<MARing.R>
            A list of quadratic forms in the ideal of the Veronese surface V
            (see ".get_ideal_lst()"), such that the quadratic forms are 
            invariant under the automorphisms of V as defined by "c_lst_lst"
            and such that the quadratic forms generate the module of  
            all invariant quadratic forms. Note that Aut(V)=Aut(P^2).   
        '''

        # for verbose output
        #
        mt = MATools()

        # initialize vectors for indeterminates of "MARing.R"
        #
        x = MARing.x()[:6]
        q = MARing.q()[:6]
        r = MARing.r()[:6]

        # obtain algebraic conditions on q0,...,q19
        # so that the associated quadratic form is invariant
        # wrt. the automorphism defined by input "c_lst_lst"
        #
        iq_lst = []
        for c_lst in c_lst_lst:
            iq_lst += Veronese.get_invariant_q_lst(c_lst)
        iq_lst = list(MARing.R.ideal(iq_lst).groebner_basis())

        # solve the ideal defined by "iq_lst"
        #
        sol_dct = MARing.solve(iq_lst, q)

        # substitute the solution in the quadratic form
        # associated to the symmetric matrix qmat.
        #
        qmat = Veronese.get_qmat()
        qpol = list(sage_vector(x).row() * qmat *
                    sage_vector(x).column())[0][0]
        sqpol = qpol.subs(sol_dct)
        mt.p('sqpol   =', sqpol)
        mt.p('r       =', r)
        assert sqpol.subs({ri: 0 for ri in r}) == 0
        iqf_lst = []  # iqf=invariant quadratic form
        for i in range(len(r)):
            coef = sqpol.coefficient(r[i])
            if coef != 0:
                iqf_lst += [coef]
        mt.p('iqf_lst =', iqf_lst)

        return iqf_lst