Ejemplo n.º 1
0
    def test__change_basis_leftright(self):
        qf_lst = DSegre.get_ideal_lst()
        nqf_lst = DSegre.change_basis(qf_lst, 'leftright')

        chk_lst = '['
        chk_lst += 'x0^2 - x1^2 - x2^2,'
        chk_lst += 'x0^2 - x3*x4,'
        chk_lst += 'x0^2 + I*x5*x6 - x5*x7 - x6*x8 - I*x7*x8,'
        chk_lst += 'x0^2 - I*x5*x6 - x5*x7 - x6*x8 + I*x7*x8,'
        chk_lst += 'x1^2 + 2*I*x1*x2 - x2^2 - I*x5*x6 - x5*x7 + x6*x8 - I*x7*x8,'
        chk_lst += 'x1^2 - 2*I*x1*x2 - x2^2 + I*x5*x6 - x5*x7 + x6*x8 + I*x7*x8,'
        chk_lst += 'x3^2 - x5^2 - x8^2,'
        chk_lst += 'x4^2 - x6^2 - x7^2,'
        chk_lst += 'x0*x1 + I*x0*x2 - x4*x5 - I*x4*x8,'
        chk_lst += 'x0*x1 - I*x0*x2 + I*x3*x6 - x3*x7,'
        chk_lst += 'x0*x3 - x1*x5 + I*x2*x5 - I*x1*x8 - x2*x8,'
        chk_lst += 'x0*x4 + I*x1*x6 - x2*x6 - x1*x7 - I*x2*x7,'
        chk_lst += 'x0*x1 + I*x0*x2 - I*x3*x6 - x3*x7,'
        chk_lst += 'x0*x1 - I*x0*x2 - x4*x5 + I*x4*x8,'
        chk_lst += 'x0*x3 - x1*x5 - I*x2*x5 + I*x1*x8 - x2*x8,'
        chk_lst += 'x0*x4 - I*x1*x6 - x2*x6 - x1*x7 + I*x2*x7,'
        chk_lst += '-x1*x3 - I*x2*x3 + x0*x5 + I*x0*x8,'
        chk_lst += '-x1*x4 + I*x2*x4 - I*x0*x6 + x0*x7,'
        chk_lst += '-x1*x4 - I*x2*x4 + I*x0*x6 + x0*x7,'
        chk_lst += '-x1*x3 + I*x2*x3 + x0*x5 - I*x0*x8'
        chk_lst += ']'

        for nqf in nqf_lst:
            print(nqf)
        assert nqf_lst == ring(chk_lst)
Ejemplo n.º 2
0
    def test__change_basis_rotate(self):
        qf_lst = DSegre.get_ideal_lst()
        nqf_lst = DSegre.change_basis(qf_lst, 'rotate')

        chk_lst = '['
        chk_lst += 'x0^2 - x1^2 - x2^2,'
        chk_lst += 'x0^2 - x3^2 - x4^2,'
        chk_lst += 'x0^2 - x5^2 - x6^2,'
        chk_lst += 'x0^2 - x7^2 - x8^2,'
        chk_lst += 'x1^2 + 2*I*x1*x2 - x2^2 - x5*x7 - I*x6*x7 - I*x5*x8 + x6*x8,'
        chk_lst += 'x1^2 - 2*I*x1*x2 - x2^2 - x5*x7 + I*x6*x7 + I*x5*x8 + x6*x8,'
        chk_lst += 'x3^2 + 2*I*x3*x4 - x4^2 - x5*x7 - I*x6*x7 + I*x5*x8 - x6*x8,'
        chk_lst += 'x3^2 - 2*I*x3*x4 - x4^2 - x5*x7 + I*x6*x7 - I*x5*x8 - x6*x8,'
        chk_lst += 'x0*x1 + I*x0*x2 - x3*x5 + I*x4*x5 - I*x3*x6 - x4*x6,'
        chk_lst += 'x0*x1 - I*x0*x2 - x3*x5 - I*x4*x5 + I*x3*x6 - x4*x6,'
        chk_lst += 'x0*x3 + I*x0*x4 - x1*x5 + I*x2*x5 - I*x1*x6 - x2*x6,'
        chk_lst += 'x0*x3 - I*x0*x4 - x1*x5 - I*x2*x5 + I*x1*x6 - x2*x6,'
        chk_lst += 'x0*x1 + I*x0*x2 - x3*x7 - I*x4*x7 - I*x3*x8 + x4*x8,'
        chk_lst += 'x0*x1 - I*x0*x2 - x3*x7 + I*x4*x7 + I*x3*x8 + x4*x8,'
        chk_lst += 'x0*x3 + I*x0*x4 - x1*x7 - I*x2*x7 + I*x1*x8 - x2*x8,'
        chk_lst += 'x0*x3 - I*x0*x4 - x1*x7 + I*x2*x7 - I*x1*x8 - x2*x8,'
        chk_lst += '-x1*x3 - I*x2*x3 - I*x1*x4 + x2*x4 + x0*x5 + I*x0*x6,'
        chk_lst += '-x1*x3 + I*x2*x3 + I*x1*x4 + x2*x4 + x0*x5 - I*x0*x6,'
        chk_lst += '-x1*x3 - I*x2*x3 + I*x1*x4 - x2*x4 + x0*x7 + I*x0*x8,'
        chk_lst += '-x1*x3 + I*x2*x3 - I*x1*x4 - x2*x4 + x0*x7 - I*x0*x8'
        chk_lst += ']'

        assert nqf_lst == ring(chk_lst)
Ejemplo n.º 3
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
Ejemplo n.º 4
0
    def test__get_invariant_q_lst(self):
        k = ring('k')

        ig_lst = DSegre.get_invariant_q_lst(
            [k + 1, 0, 0, 1 / (k + 1), 1, 0, 0, 1])
        print(ig_lst)
        assert ig_lst == ring(
            '[q8 + q12, -q9 - q13, q16, -q17, q18, -q19, q8 + q12, 4*q4, -q16, -q18, -q9 - q13, (-4)*q5, q19, q17, -q16, q19, q9, -q12, -q18, q17, -q8, q13, q16, -q8, (-2)*q4, -q17, q9, 2*q5, q18, -q12, (-2)*q4, -q19, q13, 2*q5]'
        )

        ig_lst = DSegre.get_invariant_q_lst([1, k, 0, 1, 1, 0, 0, 1])
        print(ig_lst)
        assert ig_lst == ring(
            '[2*q8 + 2*q12, 2*q4, q1 + q2 + q3, (-1/2)*q11 + 1/2*q15, 1/2*q10 + (-1/2)*q14, 2*q4, 1/2*q8 + 1/2*q12, (-1/2)*q18, (-1/2)*q16, q1 + q2 + q3, 1/2*q8 + 1/2*q12, q9 + q13, (-1/2)*q10 + 1/2*q14, 1/2*q11 + (-1/2)*q15, 1/2*q16, 1/2*q18, (-1/2)*q10 + 1/2*q14, -q8 - q12, (-1/2)*q1 - q2, -q4, 1/2*q11 + (-1/2)*q15, -q8 - q12, -q4, (-1/2)*q1 - q3, 1/2*q16, -q4, (-1/2)*q8, (-1/2)*q11 + 1/2*q15, (-1/2)*q18, (-1/2)*q1 - q2, (-1/2)*q8, (-1/2)*q9 + (-1/2)*q13, 1/2*q18, -q4, (-1/2)*q12, 1/2*q10 + (-1/2)*q14, (-1/2)*q16, (-1/2)*q1 - q3, (-1/2)*q9 + (-1/2)*q13, (-1/2)*q12]'
        )
Ejemplo n.º 5
0
    def test__get_invariant_qf__5678_SO2xSO2(self):
        k = ring('k')
        c_lst_lst = []
        c_lst_lst += [[k + 1, 0, 0, 1 / (k + 1), 1, 0, 0, 1]]
        c_lst_lst += [[1, 0, 0, 1, k + 1, 0, 0, 1 / (k + 1)]]

        iqf_lst = DSegre.get_invariant_qf(c_lst_lst, [5, 6, 7, 8])
        print(iqf_lst)
        assert iqf_lst == ring('[x0^2 - x1*x2, x0^2 - x3*x4]')
Ejemplo n.º 6
0
    def test__get_invariant_qf__SO2xSO2(self):
        k = ring('k')
        c_lst_lst = []
        c_lst_lst += [[k + 1, 0, 0, 1 / (k + 1), 1, 0, 0, 1]]
        c_lst_lst += [[1, 0, 0, 1, k + 1, 0, 0, 1 / (k + 1)]]

        iqf_lst = DSegre.get_invariant_qf(c_lst_lst)
        print(iqf_lst)
        assert iqf_lst == ring(
            '[x0^2 - x7*x8, x0^2 - x5*x6, x0^2 - x3*x4, x0^2 - x1*x2]')
Ejemplo n.º 7
0
    def test__get_ideal_lst__56_y(self):
        chk_str = '['
        chk_str += 'y0^2 - y1*y2, y0^2 - y3*y4, y0^2 - y7*y8,'
        chk_str += 'y0*y1 - y3*y7, y0*y2 - y4*y8, y0*y3 - y1*y8,'
        chk_str += 'y0*y4 - y2*y7, -y1*y4 + y0*y7, -y2*y3 + y0*y8'
        chk_str += ']'

        out = DSegre.get_ideal_lst([5, 6], 'y')
        print(out)
        assert out == ring(chk_str)
Ejemplo n.º 8
0
    def test__get_aut_P8__action_of_involution(self):
        '''
        OUPUT:
            -   We check how the action of the involution J: P^8---->P^8 acts on 
                elements "c_lst" in Aut(P^1xP^1) by conjugation. See documentation 
                "DSegre.change_basis()" and "DSegre.get_aut_P8()" for our internal 
                implementation of J and "c_lst" respectively.              
        '''
        a, b, c, d, e, f, g, h = ring('a, b, c, d, e, f, g, h')

        # left-right involution
        #
        M = DSegre.get_aut_P8([a, b, c, d] + [e, f, g, h])
        L = sage_matrix([(1, 0, 0, 0, 0, 0, 0, 0, 0),
                         (0, 0, 1, 0, 0, 0, 0, 0, 0),
                         (0, 1, 0, 0, 0, 0, 0, 0, 0),
                         (0, 0, 0, 1, 0, 0, 0, 0, 0),
                         (0, 0, 0, 0, 1, 0, 0, 0, 0),
                         (0, 0, 0, 0, 0, 0, 0, 0, 1),
                         (0, 0, 0, 0, 0, 0, 0, 1, 0),
                         (0, 0, 0, 0, 0, 0, 1, 0, 0),
                         (0, 0, 0, 0, 0, 1, 0, 0, 0)])
        assert L == ~L
        LML = ~L * M * L
        LML_chk = DSegre.get_aut_P8([d, c, b, a] + [e, f, g, h])
        assert LML_chk == LML

        # rotate
        #
        M = DSegre.get_aut_P8([a, b, c, d] + [e, f, g, h])
        R = sage_matrix([(1, 0, 0, 0, 0, 0, 0, 0, 0),
                         (0, 0, 1, 0, 0, 0, 0, 0, 0),
                         (0, 1, 0, 0, 0, 0, 0, 0, 0),
                         (0, 0, 0, 0, 1, 0, 0, 0, 0),
                         (0, 0, 0, 1, 0, 0, 0, 0, 0),
                         (0, 0, 0, 0, 0, 0, 1, 0, 0),
                         (0, 0, 0, 0, 0, 1, 0, 0, 0),
                         (0, 0, 0, 0, 0, 0, 0, 0, 1),
                         (0, 0, 0, 0, 0, 0, 0, 1, 0)])
        assert R == ~R
        RMR = ~R * M * R
        RMR_chk = DSegre.get_aut_P8([d, c, b, a] + [h, g, f, e])
        assert RMR_chk == RMR
Ejemplo n.º 9
0
def usecase__invariant_quadratic_forms_experiment():
    '''
    We output for given subgroup G of Aut(P^1xP^1),
    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 )"
    
    This method is for experimentation with different
    groups and real structures. The parameters are set 
    in the code. 
    '''
    #
    # 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()

    #
    # set input parameters
    #
    exc_idx_lst = []
    c_lst_lst = [s + e, e + t]
    involution = 'leftright'
    MATools.p('exc_idx_lst =', exc_idx_lst)
    MATools.p('c_lst_lst   =', DSegre.to_str(c_lst_lst))
    MATools.p('involution  =', involution)
    MATools.p('---')

    #
    # compute vector space of real invariant quadratic forms.
    #
    iq_lst = DSegre.get_invariant_qf(c_lst_lst, exc_idx_lst)
    MATools.p('invariant quadratic forms =\n\t', iq_lst)
    iq_lst = DSegre.change_basis(iq_lst, involution)
    MATools.p('change basis              =\n\t', iq_lst)
    iq_lst = MARing.replace_conj_pairs(iq_lst)
    MATools.p('replaced conjugate pairs  =\n\t', iq_lst)
Ejemplo n.º 10
0
    def test__to_str(self):

        s = '[ '
        for c_lst_lst in DSegre.get_c_lst_lst_lst():
            s += DSegre.to_str(c_lst_lst) + ', '
        s = s[:-2] + ' ]'
        print(s)

        chk = '[ '
        chk += '< t1, q1, s1 >, < t1, s1 >, < t1 >, < s1 >, < r1 >, '
        chk += '< t1, q1, s1, t2, q2, s2 >, < t1, q1, s1, t2, s2 >, '
        chk += '< t1, q1, s1, t2 >, < t1, q1, s1, s2 >, < t1, q1, s1, r2 >, '

        chk += '< t1, s1, t2, s2 >, < t1, s1, t2 >, < t1, s1, s2 >, < t1, s1, r2 >, '
        chk += '< t1, t2 >, < t1, s2 >, < t1, r2 >, < s1, s2 >, < s1, r2 >, < r1, r2 >, '

        chk += '< t1+t2, g1+q2, s1+s2 >, < t1+t2, s1+s2 >, < t1+t2 >, < s1+s2 >, < r1+r2 >, '
        chk += '< t1+s2 >, < t1+r2 >, < s1+r2 >, '

        chk += '< s1+s2, t1, t2 >, < s1+t2, t1 >, < s1+s2, t1 >, < s1+r2, t1 > '
        chk += ']'

        assert s == chk
Ejemplo n.º 11
0
 def test__get_c_lst_lst_lst(self):
     k = ring('k')
     for c_lst_lst in DSegre.get_c_lst_lst_lst():
         for c_lst in c_lst_lst:
             # evaluate at k=0
             n_lst = []
             for c in c_lst:
                 if c in sage_ZZ:
                     n_lst += [c]
                 else:
                     n_lst += [c.subs({k: 0})]
             print(n_lst)
             assert n_lst == [1, 0, 0, 1, 1, 0, 0, 1]
             for c in c_lst:
                 assert c in MARing.FF
Ejemplo n.º 12
0
    def test__qmat(self):
        chk_mat = ''
        chk_mat += '['
        chk_mat += '(q0 + q1 + q2 + q3, 1/2*q8 + 1/2*q12, 1/2*q9 + 1/2*q13, 1/2*q10 + 1/2*q14, 1/2*q11 + 1/2*q15, 1/2*q16, 1/2*q17, 1/2*q18, 1/2*q19),'
        chk_mat += '(1/2*q8 + 1/2*q12, q4, (-1/2)*q0, (-1/2)*q16, (-1/2)*q18, 0, (-1/2)*q11, 0, (-1/2)*q14),'
        chk_mat += '(1/2*q9 + 1/2*q13, (-1/2)*q0, q5, (-1/2)*q19, (-1/2)*q17, (-1/2)*q10, 0, (-1/2)*q15, 0),'
        chk_mat += '(1/2*q10 + 1/2*q14, (-1/2)*q16, (-1/2)*q19, q6, (-1/2)*q1, 0, (-1/2)*q9, (-1/2)*q12, 0),'
        chk_mat += '(1/2*q11 + 1/2*q15, (-1/2)*q18, (-1/2)*q17, (-1/2)*q1, q7, (-1/2)*q8, 0, 0, (-1/2)*q13),'
        chk_mat += '(1/2*q16, 0, (-1/2)*q10, 0, (-1/2)*q8, 0, (-1/2)*q2, (-1/2)*q4, (-1/2)*q6),'
        chk_mat += '(1/2*q17, (-1/2)*q11, 0, (-1/2)*q9, 0, (-1/2)*q2, 0, (-1/2)*q7, (-1/2)*q5),'
        chk_mat += '(1/2*q18, 0, (-1/2)*q15, (-1/2)*q12, 0, (-1/2)*q4, (-1/2)*q7, 0, (-1/2)*q3),'
        chk_mat += '(1/2*q19, (-1/2)*q14, 0, 0, (-1/2)*q13, (-1/2)*q6, (-1/2)*q5, (-1/2)*q3, 0)'
        chk_mat += ']'
        chk_mat = 'matrix(' + chk_mat + ')'

        qmat = DSegre.get_qmat()
        for row in qmat:
            print(row)
        assert qmat == ring(chk_mat)
Ejemplo n.º 13
0
    def test__get_aut_P8__abcdefgh(self):
        chk_mat = ''
        chk_mat += '['
        chk_mat += '(b*c*f*g + a*d*f*g + b*c*e*h + a*d*e*h, a*c*f*g + a*c*e*h, b*d*f*g + b*d*e*h, b*c*e*g + a*d*e*g, b*c*f*h + a*d*f*h, a*c*e*g, b*d*f*h, a*c*f*h, b*d*e*g),'
        chk_mat += '(2*a*b*f*g + 2*a*b*e*h, a^2*f*g + a^2*e*h, b^2*f*g + b^2*e*h, 2*a*b*e*g, 2*a*b*f*h, a^2*e*g, b^2*f*h, a^2*f*h, b^2*e*g),'
        chk_mat += '(2*c*d*f*g + 2*c*d*e*h, c^2*f*g + c^2*e*h, d^2*f*g + d^2*e*h, 2*c*d*e*g, 2*c*d*f*h, c^2*e*g, d^2*f*h, c^2*f*h, d^2*e*g),'
        chk_mat += '(2*b*c*e*f + 2*a*d*e*f, 2*a*c*e*f, 2*b*d*e*f, b*c*e^2 + a*d*e^2, b*c*f^2 + a*d*f^2, a*c*e^2, b*d*f^2, a*c*f^2, b*d*e^2),'
        chk_mat += '(2*b*c*g*h + 2*a*d*g*h, 2*a*c*g*h, 2*b*d*g*h, b*c*g^2 + a*d*g^2, b*c*h^2 + a*d*h^2, a*c*g^2, b*d*h^2, a*c*h^2, b*d*g^2),'
        chk_mat += '(4*a*b*e*f, 2*a^2*e*f, 2*b^2*e*f, 2*a*b*e^2, 2*a*b*f^2, a^2*e^2, b^2*f^2, a^2*f^2, b^2*e^2),'
        chk_mat += '(4*c*d*g*h, 2*c^2*g*h, 2*d^2*g*h, 2*c*d*g^2, 2*c*d*h^2, c^2*g^2, d^2*h^2, c^2*h^2, d^2*g^2),'
        chk_mat += '(4*a*b*g*h, 2*a^2*g*h, 2*b^2*g*h, 2*a*b*g^2, 2*a*b*h^2, a^2*g^2, b^2*h^2, a^2*h^2, b^2*g^2),'
        chk_mat += '(4*c*d*e*f, 2*c^2*e*f, 2*d^2*e*f, 2*c*d*e^2, 2*c*d*f^2, c^2*e^2, d^2*f^2, c^2*f^2, d^2*e^2)'
        chk_mat += ']'

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

        a, b, c, d, e, f, g, h = ring('a, b, c, d, e, f, g, h')
        out = DSegre.get_aut_P8([a, b, c, d, e, f, g, h])
        print(list(out))
        print(out)
        assert out == ring(chk_mat)
Ejemplo n.º 14
0
    def test__get_aut_P8__SO2xID(self):
        chk_mat = ''
        chk_mat += '['
        chk_mat += '(1, 0, 0, 0, 0, 0, 0, 0, 0),'
        chk_mat += '(0, k^2 + 2*k + 1, 0, 0, 0, 0, 0, 0, 0),'
        chk_mat += '(0, 0, 1/(k^2 + 2*k + 1), 0, 0, 0, 0, 0, 0),'
        chk_mat += '(0, 0, 0, 1, 0, 0, 0, 0, 0),'
        chk_mat += '(0, 0, 0, 0, 1, 0, 0, 0, 0),'
        chk_mat += '(0, 0, 0, 0, 0, k^2 + 2*k + 1, 0, 0, 0),'
        chk_mat += '(0, 0, 0, 0, 0, 0, 1/(k^2 + 2*k + 1), 0, 0),'
        chk_mat += '(0, 0, 0, 0, 0, 0, 0, k^2 + 2*k + 1, 0),'
        chk_mat += '(0, 0, 0, 0, 0, 0, 0, 0, 1/(k^2 + 2*k + 1))'
        chk_mat += ']'
        chk_mat = 'matrix(' + chk_mat + ')'

        k = ring('k')
        out = DSegre.get_aut_P8([k + 1, 0, 0, 1 / (k + 1), 1, 0, 0, 1])
        print(list(out))
        print(out)
        t = (k + 1)**2
        assert out == sage_diagonal_matrix(
            [1, t, 1 / t, 1, 1, t, 1 / t, t, 1 / t])
Ejemplo n.º 15
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)
Ejemplo n.º 16
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()
Ejemplo n.º 17
0
def usecase__toric_invariant_celestials():
    '''  
    We output the ideal and Hilbert polynomial of all possible 
    toric projections of the double Segre  surface. For 
    each generator in the ideal we consider its coordinate
    change such that the real structure corresponding 
    to leftright/rotate becomes complex conjugation
    (see "DSegre.change_basis()").
    
    Notes
    -----
    Suppose that G is the group of toric automorphisms
    of the double Serge surface X in P^8. The double 
    Segre surface admits a monomial parametrization. 
    The exponents corresponds to lattice points on 
    a square. We number these lattice points as follows:
    
        8  3  5
        2  0  1  
        6  4  7
    
    These exponents correspond to following parametrization:  
    
    (s,u) |-->
        (1:s:s^{-1}:u:u^{-1}:s*u:s^{-1}*u^{-1}:s*u^{-1}:s^{-1}*u)
        =
        (x0:x1:x2:x3:x4:x5:x6:x7:x8)
    
    The identity component of the toric automorphisms G are 
    represented by 9x9 diagonal matrices and are isomorphic to the 
    group SO(2)xSO(2). The vector space of G-invariant quadratic 
    forms in the ideal of the double Segre surface in P^8 is 
    generated by:
    
      V = < x0^2 - x7^2 - x8^2, 
            x0^2 - x5^2 - x6^2, 
            x0^2 - x3^2 - x4^2, 
            x0^2 - x1^2 - x2^2 >
    
    A quadric Q in V of signature (1,n+1) corresponds to 
    a celestial Y in the unit sphere S^n as follows: S^n
    is up to real projective equivalence defined by the
    projection of Q from its singular locus. The celestial
    Y is the image of the double Segre surface X under this 
    projection. Note that the singular locus of Q can intersect
    X such that Y is of lower degree. Another possibility is
    that the projection restricted to X is 2:1 such that the 
    degree of Y is 4. It turns out that projection of X with
    center singular locus of Q is toric in the sense we obtain
    ---up to projective equivalence---a parametrization by
    omitting monomials in the parametrization above. Using the 
    labels 0-8 of the lattice points in the square we consider
    the following projections, where P denotes the list of 
    monomials which are omitted:
    
    Q = (x0^2-x7^2-x8^2)+(x0^2-x5^2-x6^2)  
    P = [1,2,3,4]
    
    Q = (x0^2-x7^2-x8^2)+(x0^2-x3^2-x4^2)  
    P = [1,2,5,6]
    
    Q = (x0^2-x7^2-x8^2)+(x0^2-x1^2-x2^2)  
    P = [1,2,3,4]
    
    Q = (x0^2-x7^2-x8^2)+(x0^2-x3^2-x4^2)  
    P = [1,2,5,6]        
                             
    '''

    # ideal of the double Segre surface in
    # coordinate ring R of P^8
    #
    IX = DSegre.get_ideal_lst()
    R = sage_PolynomialRing(sage_QQ, ['x' + str(i) for i in range(9)])
    IX = R.ideal(sage__eval(str(IX), R.gens_dict()))

    # we consider all possible projections from the singular
    # locus of Q (see OUPUT documention).
    #
    prevP_lst = []
    for P1 in [[1, 2], [3, 4], [5, 6], [7, 8]]:
        for P2 in [[1, 2], [3, 4], [5, 6], [7, 8]]:

            # construct indices for projection map
            #
            P = sorted(list(set(P1 + P2)))
            if P not in prevP_lst:
                prevP_lst += [P]
            else:
                continue

            # project the double Segre surface wrt. P
            #
            J = IX.elimination_ideal(
                [sage__eval('x' + str(i), R.gens_dict()) for i in P])

            # in order to get the right Hilbert polynomial we coerce into smaller ring
            #
            RP = sage_PolynomialRing(
                sage_QQ, ['x' + str(i) for i in range(9) if i not in P])
            JP = RP.ideal(sage__eval(str(J.gens()), RP.gens_dict()))
            hpol = JP.hilbert_polynomial()

            # output info
            #
            if not JP.is_zero():
                MATools.p(10 * '-')
                MATools.p(
                    'set of i such that <xi for i in P> is the ideal of the center of projection:'
                )
                MATools.p('\t', P)
                MATools.p('projection of double Segre surface wrt. P:')
                for gen in JP.gens():
                    MATools.p('\t', gen)
                    for involution in ['leftright', 'rotate']:
                        MATools.p('\t\t', involution, '\t',
                                  DSegre.change_basis([ring(gen)], involution))
                MATools.p('hilbert polynomial ((deg/dim!)*t^(dim)+...):')
                MATools.p('\t', hpol)
Ejemplo n.º 18
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 * '-')
Ejemplo n.º 19
0
 def test__get_pmz_lst(self):
     out = DSegre.get_pmz_lst()
     print(out)
     assert len(out) == 9
Ejemplo n.º 20
0
 def test__qmat__symmetric(self):
     qmat = DSegre.get_qmat()
     print(qmat)
     assert qmat == qmat.T
Ejemplo n.º 21
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)
Ejemplo n.º 22
0
    def test__change_basis_identity(self):
        qf_lst = DSegre.get_ideal_lst()
        nqf_lst = DSegre.change_basis(qf_lst, 'identity')

        assert qf_lst == nqf_lst