def test__solve__empty_list(self): q = MARing.q() pol_lst = [] var_lst = [q[i] for i in [0, 1, 2]] sol_dct = MARing.solve(pol_lst, var_lst) print(sol_dct) assert 'r0' in str(sol_dct)
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
def test__diff_mat__a00b(self): mat = ring('matrix([(a,0),(0,1/a)])') a = ring('a') dmat = MARing.diff_mat(mat, a) print(mat) print(dmat) assert dmat == sage_matrix(MARing.FF, [(1, 0), (0, -1 / a**2)])
def get_invariant_q_lst(c_lst): ''' Parameters ---------- c_lst : list A list of length 9 with elements c0,...,c8 in the subring in QQ(k) of "MARing.FF". The matrix [ c0 c1 c2 ] M = [ c3 c4 c5 ] [ c6 c7 c8 ] represents---for each value of k---an automorphism of P^2. If we set k:=0 then "c_lst" must correspond to the identity matrix: [ 1,0,0, 0,1,0, 0,0,1 ]. If M is not normalized to have determinant 1 then the method should be taken with care (see doc. ".get_c_lst_lst_dct"). Returns ------- list<MARing.R> A list of generators of an ideal J in the subring QQ[q0,...,q6] of "MARing.R". Each point p in the zeroset V(J), when substituted in the matrix ".get_qmat()", defines a quadratic form in the ideal ".get_ideal_lst()" that is preserved by a 1-parameter subgroup H, where H is the representation of M in P^5 (see ".get_aut_P5()"). Thus H corresponds to a 1-parameter subgroup of Aut(P^5), such that each automorphism preserves the Veronese surface in projective 5-space P^5. ''' # get representation of 1-parameter subgroup in Aut(P^5) # H = Veronese.get_aut_P5(c_lst) # consider the tangent vector of the curve H at the identity # k = ring('k') D = MARing.diff_mat(H, k).subs({k: 0}) MATools.p('D =\n' + str(D)) # Note that if we differentiate the condition # A=H.T*A*H on both sides, evaluate k=0, then # we obtain the condition D.T * A + A * D=0. # Here A denotes the matrix of a quadratic form # in the ideal of the double Segre surface S. # A = Veronese.get_qmat() Z = D.T * A + A * D iq_lst = [iq for iq in Z.list() if iq != 0] MATools.p('qi_lst =', iq_lst) return iq_lst
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
def test__solve(self): q = MARing.q() pol_lst = [q[0] + 2 * q[1] + 3 * q[2] - 4] var_lst = [q[i] for i in [0, 1, 2]] sol_dct = MARing.solve(pol_lst, var_lst) print(sol_dct) assert 'r0' in str(sol_dct) # We call a second time so that sage internally # introduces new variable names. We undo this # in MARing.solve(), since we work in a # polynomial ring where we want to minimize # the number of variables. # sol_dct = MARing.solve(pol_lst, var_lst) print(sol_dct) assert 'r0' in str(sol_dct)
def test__replace_conj_pairs(self): q_lst = ring('[ x0-I*x1, x0+I*x1, x0+x2, x3*I, x3+I*x4]') new_lst = MARing.replace_conj_pairs(q_lst) chk_lst = sorted(ring('[ x0, x1, x0+x2, x3, x3+I*x4]')) print(q_lst) print(new_lst) print(chk_lst) assert chk_lst == new_lst
def test__get_invariant_q_lst__SO2(self): h1, h2, a1, a2, a3, b1, b2, b3 = Veronese.get_c_lst_lst_dct()['SL3(C)'] q_lst = Veronese.get_invariant_q_lst(h1) out = sorted(list(set(q_lst))) print('q_lst =', q_lst) print('out =', out) q0, q1, q2, q3, q4, q5 = MARing.q()[:6] assert out == ring( '[-1/2*q5, 1/2*q5, -1/2*q4, 1/2*q4, -2*q3, q3, -q2, 2*q2]')
def get_qmat(exc_idx_lst=[]): ''' Parameters ---------- exc_idx_lst : list<int> A list of integers in [0,8]. Returns ------- sage_matrix<MARing.R> A symmetric 9x9 matrix with entries in the ring QQ[q0,...,q19] which is a subring of "MARing.R". It represents the Gramm matrix of a quadratic form in the ideal of the double Segre surface or a projection of the double Segre surface with ideal defined by "get_ideal_lst( exc_idx_lst )". Method ------ We obtain generators of the ideal of the (projection of) the double Segre surface with the method "get_ideal_lst( exc_idx_lst )". If the ideal is of a projection of the double Segre surface, then the returned matrix with parameters q0,...,q19 is not of full rank. ''' x = MARing.x() q = MARing.q() g_lst = DSegre.get_ideal_lst(exc_idx_lst) qpol = 0 for i in range(len(g_lst)): qpol += q[i] * g_lst[i] qmat = sage_invariant_theory.quadratic_form( qpol, x).as_QuadraticForm().matrix() qmat = sage_matrix(MARing.R, qmat) return qmat
def get_qmat(): ''' Returns ------- sage_matrix A symmetric 5x5 matrix with entries in the ring QQ[q0,...,q5] which is a subring of "MARing.R". It represents the Gramm matrix of a quadratic form in the ideal of the Veronese with ideal defined by ".get_ideal_lst()". ''' x = MARing.x()[:6] q = MARing.q()[:6] g_lst = Veronese.get_ideal_lst() qpol = 0 for i in range(len(g_lst)): qpol += q[i] * g_lst[i] qmat = sage_invariant_theory.quadratic_form( qpol, x).as_QuadraticForm().matrix() qmat = sage_matrix(MARing.R, qmat) return qmat
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)
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]
def get_invariant_qf(c_lst_lst, exc_idx_lst=[]): ''' Computes quadratic forms in the ideal of the double Segre surface that are invariant under a given subgroup of Aut(P^1xP^1). Parameters ---------- c_lst_lst : list<list<MARing.FF>> A list of "c_lst"-lists. A c_lst is a list of length 8 with elements c0,...,c7 in QQ(k), where QQ(k) is a subfield of "MARing.FF". If we substitute k:=0 in the entries of "c_lst" then we should obtain the list: [1,0,0,1,1,0,0,1]. A c_lst represents a pair of two matrices: ( [ c0 c1 ] [ c4 c5 ] ) ( [ c2 c3 ] , [ c6 c7 ] ) with the property that c0*c3-c1*c2!=0 and c4*c7-c5*c6!=0. If the two matrices are not normalized to have determinant 1 then the method should be taken with care (it should be checked that the tangent vectors at the identity generate the correct Lie algebra). exc_idx_lst : list<int> A list of integers in [0,8]. Returns ------- A list of quadratic forms in the ideal of (a projection of) the double Segre surface S: ".get_ideal_lst( exc_idx_lst )" such that the quadratic forms are invariant under the automorphisms of S as defined by "c_lst_lst" and such that the quadratic forms generate the module of all invariant quadratic forms. Note that Aut(S)=Aut(P^1xP^1). ''' # for verbose output # mt = MATools() sage_set_verbose(-1) # initialize vectors for indeterminates of "MARing.R" # x = MARing.x() q = MARing.q() r = MARing.r() # obtain algebraic conditions on q0,...,q19 # so that the associated quadratic form is invariant # wrt. the automorphism defined by input "c_lst_lst" # iq_lst = [] for c_lst in c_lst_lst: iq_lst += DSegre.get_invariant_q_lst(c_lst, exc_idx_lst) iq_lst = list(MARing.R.ideal(iq_lst).groebner_basis()) # solve the ideal defined by "iq_lst" # sol_dct = MARing.solve(iq_lst, q) # substitute the solution in the quadratic form # associated to the symmetric matrix qmat. # qmat = DSegre.get_qmat(exc_idx_lst) qpol = list(sage_vector(x).row() * qmat * sage_vector(x).column())[0][0] sqpol = qpol.subs(sol_dct) mt.p('sqpol =', sqpol) mt.p('r =', r) assert sqpol.subs({ri: 0 for ri in r}) == 0 iqf_lst = [] # iqf=invariant quadratic form for i in range(len(r)): coef = sqpol.coefficient(r[i]) if coef != 0: iqf_lst += [coef] mt.p('iqf_lst =', iqf_lst) return iqf_lst
def get_invariant_q_lst(c_lst, exc_idx_lst=[]): ''' Parameters ---------- c_lst : list<MARing.FF> A list of length 8 with elements c0,...,c7 in QQ(k), where QQ(k) is a subfield of "MARing.FF". If we substitute k:=0 in the entries of "c_lst" then we should obtain the list: [1,0,0,1,1,0,0,1]. A c_lst represents a pair of two matrices: ( [ c0 c1 ] [ c4 c5 ] ) ( [ c2 c3 ] , [ c6 c7 ] ) with the property that c0*c3-c1*c2!=0 and c4*c7-c5*c6!=0. If the two matrices are not normalized to have determinant 1, then the method should be taken with care (it should be checked that the tangent vectors at the identity generate the correct Lie algebra). exc_idx_lst : list<int> A list of integers in [0,8]. Returns ------- list<MARing.R> A list of generators of an ideal J in the subring QQ[q0,...,q19] of "MARing.R". Each point p in the zeroset V(J), when substituted in the matrix ".get_qmat(exc_idx_lst)", defines a quadratic form in the ideal ".get_ideal_lst(exc_idx_lst)" that is preserved by the 1-parameter subgroup H, where H be the representation of the pair of matrices ( [ c0 c1 ] [ c4 c5 ] ) ( [ c2 c3 ] , [ c6 c7 ] ) into P^8 (see also ".get_aut_P8()"). We assume here that H is an element in Aut(P^1xP^1) and normalized so that each 2x2 matrix has determinant 1. Thus H corresponds to a 1-parameter subgroup of Aut(P^8), such that each automorphism preserves the double Segre surface S in projective 8-space P^8. ''' # get representation of 1-parameter subgroup in Aut(P^8) # H = DSegre.get_aut_P8(c_lst) # consider the tangent vector of the curve H at the identity # k = ring('k') D = MARing.diff_mat(H, k).subs({k: 0}) # Note that if we differentiate the condition # A=H.T*A*H on both sides, evalute k=0, then # we obtain the condition D.T * A + A * D=0. # Here A denotes the matrix of a quadratic form # in the ideal of the double Segre surface S. # A = DSegre.get_qmat(exc_idx_lst) Z = D.T * A + A * D iq_lst = [iq for iq in Z.list() if iq != 0] return iq_lst
def change_basis(iqf_lst, involution='identity'): ''' This method allows us to change coordinates of the ideal generated by "iqf_lst" so that the antiholomorphic involution defined by "involution" becomes complex conjugation. Parameters ---------- iqf_lst: list<MARing> A list of elements in the subring NF[x0,...,x8] of "MARing.R" where NF denotes the Gaussian rationals QQ(I) with I^2=-1. involution: str Either one of the following strings: 'identity', 'leftright', 'rotate', 'diagonal'. Returns ------- We consider the input "iqf_lst" as a map. We compose this map composed with the map corresponding to <identity>, <leftright>, <rotate> or <diagonal>. We return a list of elements in NF[x0,...,x8] that represents the composition. Notes ----- A double Segre surface in projective 8-space P^8 is represented by a toric parametrization whose completion to P^1xP^1 is provided by "get_pmz_lst": (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) We can put the exponents of the monomials in a lattice where x0 corresponds to coordinate (0,0), x6 to (-1,-1) x5 to (1,1) and x8 to (-1,1): x8 x3 x5 x2 x0 x1 x6 x4 x7 An antiholomorphic involution, that preserves the toric structure, acts on the above lattice as a unimodular involution: identity_*: ( a, b ) |--> ( a, b) leftright_*: ( a, b ) |--> (-a, b) rotate_*: ( a, b ) |--> (-a,-b) diagonal_*: ( a, b ) |--> ( b, a) These unimodular lattice involutions induce an involution on P^8. We compose the toric parametrization of the double Segre surface with the one of the following maps in order to make the antiholomorphic involution that acts on P^8, equal to complex conjugation. identity: (x0:...:x8) |--> (x0:...:x8) leftright: x3 |--> x3, x0 |--> x0, x4 |--> x4, x1 |--> x1 + I*x2, x2 |--> x1 - I*x2, x5 |--> x5 + I*x8, x8 |--> x5 - I*x8, x7 |--> x7 + I*x6, x6 |--> x7 - I*x6 rotate: x0 |--> x0, x1 |--> x1 + I*x2, x2 |--> x1 - I*x2, x3 |--> x3 + I*x4, x4 |--> x3 - I*x4, x5 |--> x5 + I*x6, x6 |--> x5 - I*x6, x7 |--> x7 + I*x8, x8 |--> x7 - I*x8 diagonal: x5 |--> x5, x0 |--> x0, x6 |--> x6, x3 |--> x3 + I*x1, x1 |--> x3 - I*x1, x8 |--> x8 + I*x7, x7 |--> x8 - I*x7, x2 |--> x2 + I*x4, x4 |--> x2 - I*x4 ''' I = ring('I') x = x0, x1, x2, x3, x4, x5, x6, x7, x8 = MARing.x() z = z0, z1, z2, z3, z4, z5, z6, z7, z8 = MARing.z() dct = {} dct['identity'] = {x[i]: z[i] for i in range(9)} dct['rotate'] = { x0: z0, x1: z1 + I * z2, x2: z1 - I * z2, x3: z3 + I * z4, x4: z3 - I * z4, x5: z5 + I * z6, x6: z5 - I * z6, x7: z7 + I * z8, x8: z7 - I * z8 } dct['leftright'] = { x0: z0, x3: z3, x4: z4, x5: z5 + I * z8, x8: z5 - I * z8, x1: z1 + I * z2, x2: z1 - I * z2, x7: z7 + I * z6, x6: z7 - I * z6 } dct['diagonal'] = { x0: z0, x6: z6, x5: z5, x3: z3 + I * z1, x1: z3 - I * z1, x8: z8 + I * z7, x7: z8 - I * z7, x2: z2 + I * z4, x4: z2 - I * z4 } zx_dct = {z[i]: x[i] for i in range(9)} new_lst = [iqf.subs(dct[involution]).subs(zx_dct) for iqf in iqf_lst] return new_lst
def get_invariant_qf(c_lst_lst): ''' Parameters ---------- c_lst_lst : list A list of "c_lst"-lists. A c_lst is a list of length 9 with elements c0,...,c8 in the subring in QQ(k) of "MARing.FF". The matrix [ c0 c1 c2 ] M = [ c3 c4 c5 ] [ c6 c7 c8 ] represents---for each value of k---an automorphism of P^2. If we set k:=0 then "c_lst" must correspond to the identity matrix: [ 1,0,0, 0,1,0, 0,0,1 ]. If M is not normalized to have determinant 1 then the method should be taken with care (see doc. ".get_c_lst_lst_dct"). Returns ------- list<MARing.R> A list of quadratic forms in the ideal of the Veronese surface V (see ".get_ideal_lst()"), such that the quadratic forms are invariant under the automorphisms of V as defined by "c_lst_lst" and such that the quadratic forms generate the module of all invariant quadratic forms. Note that Aut(V)=Aut(P^2). ''' # for verbose output # mt = MATools() # initialize vectors for indeterminates of "MARing.R" # x = MARing.x()[:6] q = MARing.q()[:6] r = MARing.r()[:6] # obtain algebraic conditions on q0,...,q19 # so that the associated quadratic form is invariant # wrt. the automorphism defined by input "c_lst_lst" # iq_lst = [] for c_lst in c_lst_lst: iq_lst += Veronese.get_invariant_q_lst(c_lst) iq_lst = list(MARing.R.ideal(iq_lst).groebner_basis()) # solve the ideal defined by "iq_lst" # sol_dct = MARing.solve(iq_lst, q) # substitute the solution in the quadratic form # associated to the symmetric matrix qmat. # qmat = Veronese.get_qmat() qpol = list(sage_vector(x).row() * qmat * sage_vector(x).column())[0][0] sqpol = qpol.subs(sol_dct) mt.p('sqpol =', sqpol) mt.p('r =', r) assert sqpol.subs({ri: 0 for ri in r}) == 0 iqf_lst = [] # iqf=invariant quadratic form for i in range(len(r)): coef = sqpol.coefficient(r[i]) if coef != 0: iqf_lst += [coef] mt.p('iqf_lst =', iqf_lst) return iqf_lst
def change_basis(iqf_lst): ''' Parameters ---------- iqf_lst : list A list of elements in the subring NF[x0,...,x5] of "MARing.R" where NF denotes the Gaussian rationals QQ(I) with I^2=-1. Returns ------- list The input "iqf_lst" where we make the following substitution for each polynomial x0 |--> x0, x1 |--> x1, x2 |--> x2 + I*x3, x3 |--> x2 - I*x3, x4 |--> x4 + I*x5, x5 |--> x4 - I*x5. Notes ----- We consider a toric parametrization of the Veronese surface: (s,t) |--> (1 : s*t : s : t : s^2 : t^2 ) = (x0 : x1 : x2 : x3 : x4 : x5 ) We can put the exponents of the monomials in a lattice where x0 corresponds to coordinate (0,0), x4 to (2,0) and x5 to (0,2): x5 x7 x8 x3 x1 x6 x0 x2 x4 The monomial parametrization of the Veronese corresponds to the following lattice polygon: * * * * * * An antiholomorphic involution acts on the above lattice polygon as a unimodular involution: ( a, b ) |--> ( b, a) This unimodular lattice involutions induce an involution on P^5: x0 |--> x0, x1 |--> x1, x2 |--> x2 + I*x3, x3 |--> x2 - I*x3, x4 |--> x4 + I*x5, x5 |--> x4 - I*x5, ''' I = ring('I') x = x0, x1, x2, x3, x4, x5 = MARing.x()[:6] z = z0, z1, z2, z3, z4, z5 = MARing.z()[:6] dct = { x0: z0, x1: z1, x2: z2 + I * z3, x3: z2 - I * z3, x4: z4 + I * z5, x5: z4 - I * z5 } zx_dct = {z[i]: x[i] for i in range(6)} new_lst = [iqf.subs(dct).subs(zx_dct) for iqf in iqf_lst] return new_lst
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 * '-')
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)
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 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 * '-')
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()