Пример #1
0
    def test__get_bidegree(self):
        m, n = 3, 5
        mon_lst = SERing.get_mon_P1xP1(m, n)
        assert SERing.get_bidegree(mon_lst) == (3, 5)

        mat = SERing.random_matrix_QQ(4, len(mon_lst))
        pol_lst = list(mat * sage_vector(mon_lst))
        assert SERing.get_bidegree(pol_lst) == (3, 5)
Пример #2
0
 def test__get_mon_P1xP1__22(self):
     out = SERing.get_mon_P1xP1(2, 2, 'y0,y1,y2,y3')
     chk = '[y0^2*y2^2, y0^2*y2*y3, y0^2*y3^2, y0*y1*y2^2, y0*y1*y2*y3, y0*y1*y3^2, y1^2*y2^2, y1^2*y2*y3, y1^2*y3^2]'
     print(out)
     y0, y1, y2, y3 = ring('y0,y1,y2,y3')
     for p in out:
         assert p.degree(y0) + p.degree(y1) == 2
         assert p.degree(y2) + p.degree(y3) == 2
     assert str(out) == chk
Пример #3
0
 def test__get_matrix_P1P1(self):
     mat = '[(13, 1, -2, 1/2, 1, 3, 3, 0, -1), (2/5, -2/5, -2, -1, -2, -1, -5/49, 19, 0), (1, -1, 0, -3/2, 1/2, -1/22, 2, 5, -8/9), (7/23, -1/2, 0, -1, 1, 32, 1/2, 0, 1)]'
     mat = sage_matrix(sage_QQ, ring(mat))
     mon_lst = SERing.get_mon_P1xP1(2, 2)
     pol_lst = list(mat * sage_vector(mon_lst))
     out = SERing.get_matrix_P1xP1(pol_lst)
     print(mat)
     print(mon_lst)
     print(pol_lst)
     print(out)
     assert mat == out
Пример #4
0
        If 0, then random f and g are computed.
        If 1, then a usecase of f and g of bidegree (2,2) is considered
        If 2, then a usecase of f and g of bidegree (3,3) is considered 
    '''

    ######################################################################
    # We first create random parametrizations f and g                    #
    ######################################################################

    # f is of bidegree (d1, d2) with coefficent matrix matf.
    # The image of f is a surface in P^m.
    # g is constructed as the composition U o f o P
    # where the reparametrization P: P1xP1-->P1xP1 is defined by two 2x2 matrices L and R
    # and U is defined by a 4x4 matrix.
    d1, d2, m = SERing.random_elt([2, 3]), SERing.random_elt([2, 3]), 3
    matf = SERing.random_matrix_QQ(m + 1, len(SERing.get_mon_P1xP1(d1, d2)))
    matU = SERing.random_inv_matrix_QQ(m + 1)
    L = SERing.random_inv_matrix_QQ(2).list()
    R = SERing.random_inv_matrix_QQ(2).list()

    if case == 1:
        d1, d2, m = 2, 2, 3
        matf = sage_matrix(
            sage_QQ,
            ring(
                '[(3/5, 87, -1/2, 1/4, 0, 1/8, 16/5, 0, 0), (0, 11, -1/9, 44, 0, 0, -1, 0, 1/3), (1/12, -4, 0, 2, -1, 1/4, 0, -3, -1/9), (1/3, 1/4, 1, -4, 1/2, -1, -6, 2, 22)]'
            ))
        matU = sage_matrix(
            sage_QQ,
            ring(
                '[( 1, 0, -1, -3 ), ( -1 / 18, -3, 0, 15 / 2 ), ( -1, 0, 13, 1 ), ( -3, -1 / 11, -2, 3 / 23 )]'