def test__diff_mat__a00b(self):
     mat = ring('matrix([(a,0),(0,1/a)])')
     a = ring('a')
     dmat = MARing.diff_mat(mat, a)
     print(mat)
     print(dmat)
     assert dmat == sage_matrix(MARing.FF, [(1, 0), (0, -1 / a**2)])
    def get_invariant_q_lst(c_lst):
        '''                        
        Parameters
        ---------- 
        c_lst : list 
            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 generators of an ideal J in the subring 
            QQ[q0,...,q6] of "MARing.R". 
               
            Each point p in the zeroset V(J), when substituted in the matrix 
                ".get_qmat()",
            defines a quadratic form in the ideal 
                ".get_ideal_lst()"
            that is preserved by a 1-parameter subgroup H,                                         
            where H is the representation of M in P^5 (see ".get_aut_P5()"). 
            Thus H corresponds to a 1-parameter subgroup of Aut(P^5), 
            such that each automorphism preserves the Veronese surface 
            in projective 5-space P^5.
               
        '''
        # get representation of 1-parameter subgroup in Aut(P^5)
        #
        H = Veronese.get_aut_P5(c_lst)

        # consider the tangent vector of the curve H at the identity
        #
        k = ring('k')
        D = MARing.diff_mat(H, k).subs({k: 0})
        MATools.p('D =\n' + str(D))

        # Note that if we differentiate the condition
        # A=H.T*A*H on both sides, evaluate k=0, then
        # we obtain the condition D.T * A + A * D=0.
        # Here A denotes the matrix of a quadratic form
        # in the ideal of the double Segre surface S.
        #
        A = Veronese.get_qmat()
        Z = D.T * A + A * D
        iq_lst = [iq for iq in Z.list() if iq != 0]
        MATools.p('qi_lst =', iq_lst)

        return iq_lst
Example #3
0
    def get_invariant_q_lst(c_lst, exc_idx_lst=[]):
        '''                        
        Parameters
        ----------
        c_lst : list<MARing.FF>
            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
        -------
        list<MARing.R>
            A list of generators of an ideal J 
            in the subring QQ[q0,...,q19] of "MARing.R". 
               
            Each point p in the zeroset V(J), when substituted in 
            the matrix 
                ".get_qmat(exc_idx_lst)",
            defines a quadratic form in the ideal 
                ".get_ideal_lst(exc_idx_lst)"
            that is preserved by the 1-parameter subgroup H,   
            where H be the representation of the pair of matrices  
               
                ( [ c0 c1 ]   [ c4 c5 ] ) 
                ( [ c2 c3 ] , [ c6 c7 ] )
               
            into P^8 (see also ".get_aut_P8()"). We assume here 
            that H is an element in Aut(P^1xP^1) and normalized 
            so that each 2x2 matrix has determinant 1.
                
            Thus H corresponds to a 1-parameter subgroup of Aut(P^8), 
            such that each automorphism preserves the double Segre 
            surface S in projective 8-space P^8.
               
                                     
        '''
        # get representation of 1-parameter subgroup in Aut(P^8)
        #
        H = DSegre.get_aut_P8(c_lst)

        # consider the tangent vector of the curve H at the identity
        #
        k = ring('k')
        D = MARing.diff_mat(H, k).subs({k: 0})

        # Note that if we differentiate the condition
        # A=H.T*A*H on both sides, evalute k=0, then
        # we obtain the condition D.T * A + A * D=0.
        # Here A denotes the matrix of a quadratic form
        # in the ideal of the double Segre surface S.
        #
        A = DSegre.get_qmat(exc_idx_lst)
        Z = D.T * A + A * D
        iq_lst = [iq for iq in Z.list() if iq != 0]

        return iq_lst
Example #4
0
    def test__get_aut_P8__rotation_matrix(self):
        '''
        OUTPUT:
            - We verify that for the 1-parameter subgroup of rotations 
              with matrix
              
                  [ cos(k) -sin(k) ]
                  [ sin(k)  cos(k) ]
            
              it is for our Lie algebra methods sufficient to consider 
              1-parameter subgroups that have the same tangent vector
              at the identity. Note that for k=0 we need to get the identity
              and the determinant should be 1.   
        '''
        k = ring('k')
        I = ring('I')
        a, b, c, d, e, f, g, h = ring('a, b, c, d, e, f, g, h')
        x = MARing.x()
        q = MARing.q()
        r = MARing.r()

        #
        # We consider the representation of the
        # following matrix into P^8
        #
        #   (  [ 1 -k ] ,  [ 1 0 ] )
        #   (  [ k  1 ]    [ 0 1 ] )
        #
        # We define A to be the tangent vector at the
        # identity of this representation
        #
        N = DSegre.get_aut_P8([1, -k, k, 1] + [1, 0, 0, 1])
        A = MARing.diff_mat(N, k).subs({k: 0})

        #
        # We consider the representation of the
        # following matrix into P^8
        #
        #   (  [ cos(k) -sin(k) ] ,  [ 1 0 ] )
        #   (  [ sin(k)  cos(k) ]    [ 0 1 ] )
        #
        # We define B to be the tangent vector at the
        # identity of this representation
        #
        M = DSegre.get_aut_P8([a, b, c, d] + [e, f, g, h])

        a, b, c, d, e, f, g, h = sage_var('a, b, c, d, e, f, g, h')
        k = sage_var('k')
        M = sage__eval(str(list(M)), {
            'a': a,
            'b': b,
            'c': c,
            'd': d,
            'e': e,
            'f': f,
            'g': g,
            'h': h,
            'k': k
        })
        M = sage_matrix(M)
        M = M.subs({
            a: sage_cos(k),
            b: -sage_sin(k),
            c: sage_sin(k),
            d: sage_cos(k),
            e: 1,
            f: 0,
            g: 0,
            h: 1
        })

        # differentiate the entries of M wrt. k
        dmat = []
        for row in M:
            drow = []
            for col in row:
                drow += [sage_diff(col, k)]
            dmat += [drow]
        M = sage_matrix(dmat)
        B = M.subs({k: 0})

        assert str(A) == str(B)