def test__get_sig__14(self):
     pol = MARing.ring('-x0^2+x1^2+x2^2+x3^2+x4^2')
     sig = MARing.get_sig(pol)
     print(pol)
     print(sig)
     assert sig == [1, 4]
 def test__get_sig__13(self):
     pol = MARing.ring('x4^2-x6*x7 + x2^2-x6*x8 - x2*x4+x0*x6')
     sig = MARing.get_sig(pol)
     print(pol)
     print(sig)
     assert sig == [1, 3]
Example #3
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()