Пример #1
0
 def test__random_elt(self):
     assert SERing.random_elt(range(50)) in range(50)
Пример #2
0
    case : int
        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(