def test__get_rand_sigs__(self):

        pol_lst = []
        pol_lst += [ring('x4^2 - x6^2 - x7^2 ')]
        pol_lst += [ring('x0^2 - x3*x4 ')]

        sig_lst = MARing.get_rand_sigs(pol_lst, 1)
        print(sig_lst)
        assert [1, 2] in sig_lst
Esempio n. 2
0
def usecase__classification(cache=True):
    '''
    Prints a classification of quadratic forms
    that contain some fixed double Segre surface S
    in projective 8-space, such that the quadratic
    form is invariant under subgroup of Aut(S).
    We consider subgroups equivalent, if they are
    real conjugate in Aut(P^1xP^1).
    
    Parameters
    ----------
    cache : bool
        If True, then the cached result is used,
        otherwise the output is recomputed. The 
        computation may take about 9 hours.
    '''
    key = 'usecase__classification'
    if cache and key in MATools.get_tool_dct():
        MATools.p(MATools.get_tool_dct()[key])
        return

    out = ''
    for involution in ['identity', 'leftright', 'rotate']:

        for c_lst_lst in DSegre.get_c_lst_lst_lst():

            #
            # compute invariant quadratic forms
            #
            iq_lst = DSegre.get_invariant_qf(c_lst_lst)
            iq_lst = DSegre.change_basis(iq_lst, involution)
            iq_lst = MARing.replace_conj_pairs(iq_lst)

            #
            # computes signatures of random quadrics in
            # the vector space of invariant quadratic forms.
            #
            sig_lst = []
            if 'I' not in str(iq_lst):
                sig_lst = MARing.get_rand_sigs(iq_lst, 10)

            tmp = ''
            tmp += '\n\t' + 10 * '-'
            tmp += '\n\t involution        =' + involution
            tmp += '\n\t group             =' + DSegre.to_str(c_lst_lst)
            tmp += '\n\t invariant ideal   = <'
            for iq in iq_lst:
                sig = ''
                if 'I' not in str(iq):
                    sig = MARing.get_sig(iq)
                tmp += '\n\t\t' + str(iq) + '\t\t' + str(sig)
            tmp += '\n\t\t >'
            tmp += '\n\t random signatures ='
            tmp += '\n\t\t ' + str(sig_lst)
            for sig in sig_lst:
                if 1 in sig:
                    tmp += '\n\t\t' + str(sig)
            tmp += '\n\t' + 10 * '-'

            # output obtained info to screen
            MATools.p(tmp)

            # add to output string
            out += tmp

    # cache output string
    MATools.get_tool_dct()[key] = out
    MATools.save_tool_dct()
Esempio n. 3
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 * '-')
Esempio n. 4
0
def usecase__invariant_quadratic_forms(case):
    '''
    Let G be a subgroup of Aut(P^1xP^1) determined by the case-parameter.
    We output the vectors space of real G-invariant quadratic forms in
    the ideal of a (projection of) the double Segre surface
    obtained by the method:
        "DSegre.get_ideal_lst( exc_idx_lst )"                   
    The real structure is specified in terms of an involution. See 
        "DSegre.change_basis()" 
    for the specification of involutions.
    We also output signatures of random G-invariant quadratic forms. 

    Parameters
    ----------
    case : str
        Three numerical characters, which characterize
        the projection of a double Segre surface in S^n.
        For example 
            '078', 
        means 
            #families=0, #n=7, #degree=8.
        If several examples are considered for the same
        triple then we extend with a character in [a-z].
        These are currently implemented cases:
            ['087','287','365','265s','265t','443','243ss','243st']

    Notes
    -----
    See the source code below for a description of each of the cases of
    projections of double Segre surfaces that we consider.                
                    
    '''

    #
    # obtain 1-parameter subgroups whose tangent vectors at the
    # identity generates the Lie algebra sl(2)
    #
    t, q, s, r, e, T = DSegre.get_gens_sl2()

    #
    # "involution" is in { 'identity', 'leftright', 'rotate', 'diagonal' }
    #
    # "c_lst_lst" represents a subgroup G of Aut(P^1xP^1) as a list of
    # 1-parameter subgroups that generate G.
    #
    if case == '087':
        descr = '''
                This example shows that there exists a 
                quadric of signature (4,5) that is invariant
                under the full automorphism group of S.
                '''
        infoG = 'SL(2) x SL(2):  [t + e, q + e, s + e, e + t, e + q, e + s ]'
        exc_idx_lst = []
        c_lst_lst = [t + e, q + e, s + e, e + t, e + q, e + s]
        involution = 'identity'

    elif case == '287':
        descr = '''
                This example shows quadrics of signatures (1,8), 
                (1,6) and (1,4) in the ideal of the double Segre
                surface, that are invariant under a 2-dimensional 
                group of toric Moebius automorphisms.         
                '''
        infoG = 'SO(2) x SO(2): [ s + e, e + s ]'
        exc_idx_lst = []
        c_lst_lst = [s + e, e + s]
        involution = 'rotate'

    elif case == '365':
        descr = '''
                This example shows that there exists a smooth sextic Del Pezzo 
                surface in S^5 that is invariant under a 2-dimensional group 
                of toric Moebius automorphisms.
                '''
        infoG = 'SO(2) x SO(2): [ s + e, e + s ]'
        exc_idx_lst = [5, 6]
        c_lst_lst = [s + e, e + s]
        involution = 'rotate'

    elif case == '265s':
        descr = ''' 
                This example shows that there exists a singular sextic 
                Del Pezzo surface in S^5 that is invariant under a 1-dimensional 
                group of toric Moebius automorphisms. Random signatures of type 
                [1,n+1] with n>=3 found so far are: [1,4], [1,6].

                If we extend the group with [e+s] then we obtain a quadric of 
                signature [1,4]; this is the horn cyclide case with 
                generators: x0^2 - x3*x4,  x0^2 - x1^2 - x2^2,  
                
                If we extend the group with [e+t] then we obtain a quadric of 
                signature [1,4]; this is the spindle cyclide case with 
                generators: x0^2 - x3*x4,  x4^2 - x6^2 - x7^2.                                  
                '''
        infoG = 'SO(2): [ s + e ]'
        exc_idx_lst = [5, 8]
        c_lst_lst = [s + e]
        involution = 'leftright'

    elif case == '265t':
        descr = ''' 
                This example indicates that there does not exists a singular 
                sextic Del Pezzo surface in S^5 that is invariant under a 
                1-dimensional group of Moebius translations. Random signatures 
                of type [1,n+1] with n>=3 found so far are: [1,4].                                
                '''
        infoG = 'SE(1): [ e + t ]'
        exc_idx_lst = [5, 8]
        c_lst_lst = [e + t]
        involution = 'leftright'

    elif case == '443':
        descr = '''
                This example shows that the ring cyclide in S^3 admits a 
                2-dimensional family of toric Moebius automorphisms. 
                '''
        infoG = 'SO(2) x SO(2): [ s + e, e + s ]'
        exc_idx_lst = [5, 6, 7, 8]
        c_lst_lst = [s + e, e + s]
        involution = 'rotate'

    elif case == '243ss':
        descr = ''' 
                This example shows that the spindle cyclide in S^3 admits a 
                2-dimensional family of Moebius automorphisms.
                '''
        infoG = 'SO(2) x SX(1): [ s + e, e + s ]'
        exc_idx_lst = [5, 6, 7, 8]
        c_lst_lst = [s + e, e + s]
        involution = 'leftright'

    elif case == '243st':
        descr = ''' 
                This example shows that the horn cyclide in S^3 admits a 
                2-dimensional family of Moebius automorphisms.
                '''
        infoG = 'SO(2) x SE(1): [ s + e, e + t ]'
        exc_idx_lst = [1, 2, 5, 8]
        c_lst_lst = [s + e, e + t]
        involution = 'leftright'

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

    #
    # compute vector space of invariant quadratic forms
    #
    iq_lst = DSegre.get_invariant_qf(c_lst_lst, exc_idx_lst)
    iq_lst = DSegre.change_basis(iq_lst, involution)
    iq_lst = MARing.replace_conj_pairs(iq_lst)

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

    #
    # output results
    #
    while descr != descr.replace('  ', ' '):
        descr = descr.replace('  ', ' ')
    mat_str = str(sage_matrix([[8, 3, 5], [2, 0, 1], [6, 4, 7]]))
    new_mat_str = mat_str
    for ei in exc_idx_lst:
        new_mat_str = new_mat_str.replace(str(ei), ' ')
    for ei in range(0, 9):
        new_mat_str = new_mat_str.replace(str(ei), '*')

    MATools.p('\n' + 80 * '-')
    MATools.p('case        :', case)
    MATools.p('description :\n', descr + '\n' + mat_str + '\n\n' + new_mat_str)
    MATools.p('G           :', infoG)
    MATools.p('exc_idx_lst :', exc_idx_lst)
    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 * '-')