def usecase__neron_severi_lattice(): ''' Compute NS-lattice of a linear series and the dimension of complete linear with base points. ''' # Blowup of projective plane in 3 colinear points # and 2 infinitly near points. The image of the # map associated to the linear series is a quartic # del pezzo surface with 5 families of conics. Moreover # the surface contains 8 straight lines. # ring = PolyRing('x,y,z', True) p1 = (-1, 0) p2 = (0, 0) p3 = (1, 0) p4 = (0, 1) p5 = (2, 0) bp_tree = BasePointTree() bp_tree.add('z', p1, 1) bp_tree.add('z', p2, 1) bp_tree.add('z', p3, 1) bp = bp_tree.add('z', p4, 1) bp.add('t', p5, 1) ls = LinearSeries.get([3], bp_tree) LSTools.p('ls = ', ls) LSTools.p(ls.get_bp_tree(), '\n\n ', ls.get_implicit_image()) # Detects that 3 base points lie on a line. # bp_tree = BasePointTree() bp_tree.add('z', p1, 1) bp_tree.add('z', p2, 1) bp_tree.add('z', p3, 1) ls123 = LinearSeries.get([1], bp_tree) LSTools.p('ls123 =', ls123) assert ls123.pol_lst == ring.coerce('[y]') # example of infinitly near base points # that is colinear with another simple base point. # bp_tree = BasePointTree() bp_tree.add('z', p1, 1) bp = bp_tree.add('z', p4, 1) bp.add('t', (1, 0), 1) ls1 = LinearSeries.get([1], bp_tree) LSTools.p('ls1 =', ls1) assert ls1.pol_lst == ring.coerce('[x-y+z]') # Detects that an infinitly near base points # is not colinear with other point. # for p in [p1, p2, p3]: bp_tree = BasePointTree() bp = bp_tree.add('z', p4, 1) bp.add('t', p5, 1) bp_tree.add('z', p, 1) ls45i = LinearSeries.get([1], bp_tree) assert ls45i.pol_lst == [] # line with predefined tangent # bp_tree = BasePointTree() bp = bp_tree.add('z', p4, 1) bp.add('t', p5, 1) ls45 = LinearSeries.get([1], bp_tree) LSTools.p('ls45 =', ls45) assert ls45.pol_lst == ring.coerce('[x-2*y+2*z]') # class of conics through 5 basepoints # bp_tree = BasePointTree() bp_tree.add('z', p1, 1) bp_tree.add('z', p2, 1) bp_tree.add('z', p3, 1) bp = bp_tree.add('z', p4, 1) bp.add('t', p5, 1) ls1234 = LinearSeries.get([2], bp_tree) LSTools.p('ls1234 =', ls1234) LSTools.p('\t\t', sage_factor(ls1234.pol_lst[0])) assert ring.coerce('(x - 2*y + 2*z, 1)') in ring.aux_gcd(ls1234.pol_lst)[0] assert ring.coerce('(y, 1)') in ring.aux_gcd(ls1234.pol_lst)[0] # class of conics through 4 basepoints # has a fixed component # bp_tree = BasePointTree() bp_tree.add('z', p4, 1) ls4 = LinearSeries.get([1], bp_tree) LSTools.p('ls4 =', ls4) bp_tree = BasePointTree() bp_tree.add('z', p1, 1) bp_tree.add('z', p2, 1) bp_tree.add('z', p3, 1) bp_tree.add('z', p4, 1) ls1234 = LinearSeries.get([2], bp_tree) LSTools.p('ls1234 =', ls1234) # return # Compose map associated to linear series "ls" # with the inverse stereographic projection "Pinv". # R = sage_PolynomialRing(sage_QQ, 'y0,y1,y2,y3,y4,x,y,z') y0, y1, y2, y3, y4, x, y, z = R.gens() delta = y1**2 + y2**2 + y3**2 + y4**2 Pinv = [ y0**2 + delta, 2 * y0 * y1, 2 * y0 * y2, 2 * y0 * y3, 2 * y0 * y4, -y0**2 + delta ] H = sage__eval(str(ls.pol_lst), R.gens_dict()) PinvH = [ elt.subs({ y0: H[0], y1: H[1], y2: H[2], y3: H[3], y4: H[4] }) for elt in Pinv ] LSTools.p('Pinv =', Pinv) LSTools.p('H =', H) LSTools.p('Pinv o H =', PinvH) # In order to compute the NS-lattice of the image # of "PinvH" we do a base point analysis. # ls_PinvH = LinearSeries([str(elt) for elt in PinvH], ring) LSTools.p('ls_PinvH =', ls_PinvH) LSTools.p('\t\t', ls_PinvH.get_implicit_image()) if False: # takes a long time LSTools.p(ls_PinvH.get_bp_tree())
def get_linear_series(deg_lst, bp_tree): ''' INPUT: - "deg_lst" -- A list of either one or two integers representing the degree of polynomials. - "bp_tree" -- BasePointTree where base points might be in overlapping charts. We require that "bp_tree.chart_lst" equals either ['z', 'x', 'y'] or ['xv', 'xw', 'yv', 'yw']. OUTPUT: - Return A LinearSeries "ls" with base points defined by "bp_tree". The polynomials in "ls.pol_lst" are either * homogeneous in (x:y:z) and of degree "deg_tup[0]" or * bi-homogenous in (x:y)(v:w) and of bi-degree ("deg_tup[0]","deg_tup[1]") Note that there might unassigned base points. ''' # # Obtain generators of polynomial ring from "bp_tree.chart_lst" # Note that for initializing PolyRing, it is important that the # base field is not reset to the rationals QQ. The input "bp_tree" # could already be defined over some extension field. # if bp_tree.chart_lst == ['z', 'x', 'y']: ring = PolyRing('x,y,z', False) elif bp_tree.chart_lst == ['xv', 'xw', 'yv', 'yw']: ring = PolyRing('x,y,v,w', False) else: raise ValueError('Expect "bp_tree.chart_lst" in ', (['z', 'x', 'y'], ['xv', 'xw', 'yv', 'yw'])) # # Obtain linear series defined by # monomials of degree "deg_lst[0]" or bidegree ("deg_lst[0]","deg_lst[1]"). # mon_lst = get_mon_lst(deg_lst, ring.gens()) LSTools.p('mon_lst =', mon_lst) ls = class_linear_series.LinearSeries(mon_lst, ring) # # For each chart "c" we obtain a list of linear series. # ls_lst = [] for c in bp_tree.chart_lst: ls_lst += get_ls_lst(ls.copy().chart(c), bp_tree[c]) # # Create matrix whose coefficients are obtained # by evaluating each polynomial in linear series # in "ls_lst" at (0,0). # row_lst = [] for ls in ls_lst: LSTools.p(ls) for g in ls.ring.gens(): ls.subs({g: 0}) row = sage__eval(str(ls.pol_lst), PolyRing.num_field.gens_dict()) row_lst += [row] LSTools.p('matrix =', row_lst) # # Compute kernel. # kern = list(sage_matrix(row_lst).right_kernel().matrix()) LSTools.p('kernel =', kern) LSTools.p(mon_lst) # # Obtain linear series from linear conditions on "mon_lst". # if kern != []: mon_lst = ring.coerce(mon_lst) # update w.r.t. PolyRing.num_field kern = ring.coerce(kern) pol_lst = sage_matrix(kern) * sage_vector(mon_lst) else: pol_lst = [] LSTools.p(pol_lst) return class_linear_series.LinearSeries(pol_lst, ring)
def copy(self): cp_ring = PolyRing(self.gens()) cp_pol_lst = cp_ring.coerce(self.pol_lst) return LinearSeries(cp_pol_lst, cp_ring)