Exemplo n.º 1
0
    def test__change_basis(self):

        l_lst = l0, l1, l2, l3, l4, l5 = Veronese.change_basis(
            Veronese.get_ideal_lst())
        print('l_lst =', l_lst)
        #
        # l_lst = [
        # x1^2 - x4^2 - x5^2,
        # x0*x1 - x2^2 - x3^2,
        # x2^2 + (2*I)*x2*x3 - x3^2 - x0*x4 + ((-I))*x0*x5,
        # x2^2 + ((-2*I))*x2*x3 - x3^2 - x0*x4 + (I)*x0*x5,
        # x1*x2 + (I)*x1*x3 - x2*x4 + (I)*x3*x4 + ((-I))*x2*x5 - x3*x5,
        # x1*x2 + ((-I))*x1*x3 - x2*x4 + ((-I))*x3*x4 + (I)*x2*x5 - x3*x5
        # ]
        #

        m0 = l0
        m1 = l1
        m2 = (l2 + l3) * ring('1/2')
        m3 = (l2 - l3) * ring('1/2*I')
        m4 = (l4 + l5) * ring('1/2')
        m5 = (l4 - l5) * ring('1/2*I')
        m_lst = [m0, m1, m2, m3, m4, m5]
        print('m_lst =', m_lst)

        x0, x1 = ring('x0,x1')
        dct = {x1: -x0 - x1}
        n_lst = n0, n1, n2, n3, n4, n5 = [m.subs(dct) for m in m_lst]
        print('n_lst =', n_lst)

        print(n0 + 2 * n1)
        chk = ring('x1^2-x0^2-2*x2^2-2*x3^2-x4^2-x5^2')

        assert n0 + 2 * n1 == chk
Exemplo n.º 2
0
    def test__get_pmz_lst(self):

        id_lst = Veronese.get_ideal_lst()
        p = Veronese.get_pmz_lst()
        x = ring('x0,x1,x2,x3,x4,x5')
        dct = {x[i]: p[i] for i in range(5 + 1)}

        for id in id_lst:
            ids = id.subs(dct)
            print(id, '--->', ids)
            assert ids == 0
Exemplo n.º 3
0
    def test__get_invariant_q_lst__SO2(self):
        h1, h2, a1, a2, a3, b1, b2, b3 = Veronese.get_c_lst_lst_dct()['SL3(C)']

        q_lst = Veronese.get_invariant_q_lst(h1)
        out = sorted(list(set(q_lst)))
        print('q_lst =', q_lst)
        print('out   =', out)

        q0, q1, q2, q3, q4, q5 = MARing.q()[:6]

        assert out == ring(
            '[-1/2*q5, 1/2*q5, -1/2*q4, 1/2*q4, -2*q3, q3, -q2, 2*q2]')
Exemplo n.º 4
0
    def test__get_c_lst_lst_dct(self):

        k = ring('k')
        for key in Veronese.get_c_lst_lst_dct():
            for c_lst in Veronese.get_c_lst_lst_dct()[key]:
                print('key   =', key)
                print('c_lst =', c_lst)
                print('det   =', sage_matrix(3, 3, c_lst).det())

                n_lst = []
                for c in c_lst:
                    if c in sage_QQ:
                        n_lst += [c]
                    else:
                        n_lst += [c.subs({k: 0})]
                print('n_lst =', n_lst)
                print

                if key != 'SO3(R)':
                    assert sage_matrix(3, 3, c_lst).det() == 1
                assert n_lst == [1, 0, 0, 0, 1, 0, 0, 0, 1]
Exemplo n.º 5
0
    def test__get_aut_P5__abcdefghk(self):
        chk_mat = ''
        chk_mat += '['
        chk_mat += '( k^2 , 2*g*h     , 2*g*k        , 2*h*k     , g^2 , h^2 ),'
        chk_mat += '( c*f , b*d + a*e , c*d + a*f    , c*e + b*f , a*d , b*e ),'
        chk_mat += '( c*k , b*g + a*h , c*g + a*k    , c*h + b*k , a*g , b*h ),'
        chk_mat += '( f*k , e*g + d*h , f*g + d*k    , f*h + e*k , d*g , e*h ),'
        chk_mat += '( c^2 , 2*a*b     , 2*a*c        , 2*b*c     , a^2 , b^2 ),'
        chk_mat += '( f^2 , 2*d*e     , 2*d*f        , 2*e*f     , d^2 , e^2 )'
        chk_mat += ']'

        chk_mat = 'matrix(' + chk_mat + ')'

        a, b, c, d, e, f, g, h, k = ring('a, b, c, d, e, f, g, h, k')
        out = Veronese.get_aut_P5([a, b, c, d, e, f, g, h, k])
        assert out == ring(chk_mat)
Exemplo n.º 6
0
 def test__get_invariant_qf__SO3(self):
     r1, r2, r3 = Veronese.get_c_lst_lst_dct()['SO3(R)']
     iqf_lst = Veronese.get_invariant_qf([r1, r2, r3])
     print(iqf_lst)
     assert iqf_lst != []
Exemplo n.º 7
0
 def test__get_invariant_qf__SL3(self):
     sl3_lst = Veronese.get_c_lst_lst_dct()['SL3(C)']
     iqf_lst = Veronese.get_invariant_qf(sl3_lst)
     print(iqf_lst)
     assert iqf_lst == []
Exemplo n.º 8
0
def usecase__invariant_quadratic_forms_veronese(case):
    '''
    Let G be a subgroup of Aut(P^2).
    Compute the vectors space of real G-invariant quadratic forms in
    the ideal of the Veronese surface in projective 5-space P^5
    obtained by the method "Veronese.get_ideal_lst()".
                   
    The real structure is specified in terms of an involution. We have
    two equivalent choices for the involution. Either we can use 
    "Veronese.get_change_basis()" or we consider the usual complex 
    conjugation. 
        
    See the code below for a description of the cases.

    Parameters
    ----------
    case : str
        A string representing the name of a group G.
        The string should be either:
            ['1a','1b','sl3','so3']                 
    '''
    #
    # We initialize 1-parameter subgroups of SL3, whose tangent vectors at the
    # identity generate Lie subalgebras of sl3(RR) and sl3(CC).
    #
    sl3_lst = h1, h2, a1, a2, a3, b1, b2, b3 = Veronese.get_c_lst_lst_dct(
    )['SL3(C)']
    so3_lst = r1, r2, r3 = Veronese.get_c_lst_lst_dct()['SO3(R)']

    if case == '1a':
        descr = '''
                This example shows that there exists a quadric of signature 
                (1,5) in the ideal of the Veronese surface, with the involution
                that induces the involution (a,b)|->(b,a) on the lattice polygon
                of the Veronese surface. 
                '''
        infoG = 'trivial group'
        c_lst_lst = []
        involution = 'diagonal'

    elif case == '1b':
        descr = '''
                This example shows that there exists a quadric of signature 
                (1,5) in the ideal of the Veronese surface, with the involution
                that induces the identity (a,b)|->(a,b) on the lattice polygon
                of the Veronese surface. 
                '''
        infoG = 'trivial group'
        c_lst_lst = []
        involution = 'identity'

    elif case == 'sl3':
        descr = '''
                This example shows that there exists no quadric that is invariant 
                under the full automorphism group of the Veronese surface.
                '''
        infoG = 'SL3(C):  [h1, h2, a1, a2, a3, b1, b2, b3]'
        c_lst_lst = sl3_lst
        involution = 'identity'

    elif case == 'so3':
        descr = '''
                This example shows that there exists a quadric of signature 
                (1,5) in the ideal of the Veronese surface, such that this 
                quadric is invariant under the group SO(3)               
                '''
        infoG = 'SO3(R):  [r1, r2, r3]'
        c_lst_lst = so3_lst
        involution = 'identity'

    else:
        raise ValueError('Unknown case:', case)

    #
    # compute vector space of invariant quadratic forms
    #
    iq_lst = Veronese.get_invariant_qf(c_lst_lst)

    if involution == 'diagonal':
        iq_lst = Veronese.change_basis(iq_lst)
        iq_lst = MARing.replace_conj_pairs(iq_lst)
    elif involution == 'identity':
        pass
    else:
        raise ValueError('Incorrect involution: ', involution)

    #
    # computes signatures of random quadrics in
    # the vector space of invariant quadratic forms.
    #
    sig_lst = MARing.get_rand_sigs(iq_lst, 5)

    #
    # output results
    #
    while descr != descr.replace('  ', ' '):
        descr = descr.replace('  ', ' ')
    MATools.p('\n' + 80 * '-')
    MATools.p('case        :', case)
    MATools.p('description :\n', descr)
    MATools.p('G           :', infoG)
    MATools.p('involution  :', involution)
    MATools.p('G-invariant quadratic forms:')
    for iq in iq_lst:
        MATools.p('\t', iq)
    MATools.p('random signatures:')
    MATools.p('\t', sig_lst)
    for sig in sig_lst:
        if 1 in sig:
            MATools.p('\t', sig)
    MATools.p('\n' + 80 * '-')