def local_coordinates(self, pt, n): r""" Return local coordinates to precision n at the given point. Behaviour is flaky - some choices of `n` are worst that others. INPUT: - ``pt`` - an F-rational point on X which is not a point of ramification for the projection (x,y) - x. - ``n`` - the number of terms desired OUTPUT: x = x0 + t y = y0 + power series in t EXAMPLES:: sage: F = GF(5) sage: pt = (2,3) sage: R = PolynomialRing(F,2, names = ['x','y']) sage: x,y = R.gens() sage: f = y^2-x^9-x sage: C = Curve(f) sage: C.local_coordinates(pt, 9) [t + 2, -2*t^12 - 2*t^11 + 2*t^9 + t^8 - 2*t^7 - 2*t^6 - 2*t^4 + t^3 - 2*t^2 - 2] """ f = self.defining_polynomial() R = f.parent() F = self.base_ring() p = F.characteristic() x0 = F(pt[0]) y0 = F(pt[1]) astr = ["a" + str(i) for i in range(1, 2 * n)] x, y = R.gens() R0 = PolynomialRing(F, 2 * n + 2, names=[str(x), str(y), "t"] + astr) vars0 = R0.gens() t = vars0[2] yt = y0 * t**0 + add( [vars0[i] * t**(i - 2) for i in range(3, 2 * n + 2)]) xt = x0 + t ft = f(xt, yt) S = singular S.eval('ring s = ' + str(p) + ',' + str(R0.gens()) + ',lp;') S.eval('poly f = ' + str(ft) + ';') c = S('coeffs(%s, t)' % ft) N = int(c.size()) b = ["%s[%s,1]," % (c.name(), i) for i in range(2, N / 2 - 4)] b = ''.join(b) b = b[:len(b) - 1] # to cut off the trailing comma cmd = 'ideal I = ' + b S.eval(cmd) S.eval('short=0') # print using *'s and ^'s. c = S.eval('slimgb(I)') d = c.split("=") d = d[1:] d[len(d) - 1] += "\n" e = [x[:x.index("\n")] for x in d] vals = [] for x in e: for y in vars0: if str(y) in x: if len(x.replace(str(y), "")) != 0: i = x.find("-") if i > 0: vals.append( [eval(x[1:i]), x[:i], F(eval(x[i + 1:]))]) i = x.find("+") if i > 0: vals.append( [eval(x[1:i]), x[:i], -F(eval(x[i + 1:]))]) else: vals.append([eval(str(y)[1:]), str(y), F(0)]) vals.sort() k = len(vals) v = [x0 + t, y0 + add([vals[i][2] * t**(i + 1) for i in range(k)])] return v
def local_coordinates(self, pt, n): r""" Return local coordinates to precision n at the given point. Behaviour is flaky - some choices of `n` are worst that others. INPUT: - ``pt`` - an F-rational point on X which is not a point of ramification for the projection (x,y) - x. - ``n`` - the number of terms desired OUTPUT: x = x0 + t y = y0 + power series in t EXAMPLES:: sage: FF = FiniteField(5) sage: P2 = ProjectiveSpace(2, FF, names = ['x','y','z']) sage: x, y, z = P2.coordinate_ring().gens() sage: C = Curve(y^2*z^7-x^9-x*z^8) sage: pt = C([2,3,1]) sage: C.local_coordinates(pt,9) # todo: not implemented !!!! [2 + t, 3 + 3*t^2 + t^3 + 3*t^4 + 3*t^6 + 3*t^7 + t^8 + 2*t^9 + 3*t^11 + 3*t^12] """ f = self.defining_polynomial() R = f.parent() F = self.base_ring() p = F.characteristic() x0 = F(pt[0]) y0 = F(pt[1]) astr = ["a"+str(i) for i in range(1,2*n)] x,y = R.gens() R0 = PolynomialRing(F,2*n+2,names = [str(x),str(y),"t"]+astr) vars0 = R0.gens() t = vars0[2] yt = y0*t**0 + add([vars0[i]*t**(i-2) for i in range(3,2*n+2)]) xt = x0+t ft = f(xt,yt) S = singular S.eval('ring s = '+str(p)+','+str(R0.gens())+',lp;') S.eval('poly f = '+str(ft)) cmd = 'matrix c = coeffs ('+str(ft)+',t)' S.eval(cmd) N = int(S.eval('size(c)')) b = ["c["+str(i)+",1]," for i in range(2,N/2-4)] b = ''.join(b) b = b[:len(b)-1] #to cut off the trailing comma cmd = 'ideal I = '+b S.eval(cmd) c = S.eval('slimgb(I)') d = c.split("=") d = d[1:] d[len(d)-1] += "\n" e = [x[:x.index("\n")] for x in d] vals = [] for x in e: for y in vars0: if str(y) in x: if len(x.replace(str(y),"")) != 0: i = x.find("-") if i>0: vals.append([eval(x[1:i]),x[:i],F(eval(x[i+1:]))]) i = x.find("+") if i>0: vals.append([eval(x[1:i]),x[:i],-F(eval(x[i+1:]))]) else: vals.append([eval(str(y)[1:]),str(y),F(0)]) vals.sort() k = len(vals) v = [x0+t,y0+add([vals[i][2]*t**(i+1) for i in range(k)])] return v
def local_coordinates(self, pt, n): r""" Return local coordinates to precision n at the given point. Behaviour is flaky - some choices of `n` are worst that others. INPUT: - ``pt`` - an F-rational point on X which is not a point of ramification for the projection (x,y) - x. - ``n`` - the number of terms desired OUTPUT: x = x0 + t y = y0 + power series in t EXAMPLES:: sage: F = GF(5) sage: pt = (2,3) sage: R = PolynomialRing(F,2, names = ['x','y']) sage: x,y = R.gens() sage: f = y^2-x^9-x sage: C = Curve(f) sage: C.local_coordinates(pt, 9) [t + 2, -2*t^12 - 2*t^11 + 2*t^9 + t^8 - 2*t^7 - 2*t^6 - 2*t^4 + t^3 - 2*t^2 - 2] """ f = self.defining_polynomial() R = f.parent() F = self.base_ring() p = F.characteristic() x0 = F(pt[0]) y0 = F(pt[1]) astr = ["a"+str(i) for i in range(1,2*n)] x,y = R.gens() R0 = PolynomialRing(F,2*n+2,names = [str(x),str(y),"t"]+astr) vars0 = R0.gens() t = vars0[2] yt = y0*t**0+add([vars0[i]*t**(i-2) for i in range(3,2*n+2)]) xt = x0+t ft = f(xt,yt) S = singular S.eval('ring s = '+str(p)+','+str(R0.gens())+',lp;') S.eval('poly f = '+str(ft) + ';') c = S('coeffs(%s, t)'%ft) N = int(c.size()) b = ["%s[%s,1],"%(c.name(), i) for i in range(2,N/2-4)] b = ''.join(b) b = b[:len(b)-1] # to cut off the trailing comma cmd = 'ideal I = '+b S.eval(cmd) S.eval('short=0') # print using *'s and ^'s. c = S.eval('slimgb(I)') d = c.split("=") d = d[1:] d[len(d)-1] += "\n" e = [x[:x.index("\n")] for x in d] vals = [] for x in e: for y in vars0: if str(y) in x: if len(x.replace(str(y),"")) != 0: i = x.find("-") if i>0: vals.append([eval(x[1:i]),x[:i],F(eval(x[i+1:]))]) i = x.find("+") if i>0: vals.append([eval(x[1:i]),x[:i],-F(eval(x[i+1:]))]) else: vals.append([eval(str(y)[1:]),str(y),F(0)]) vals.sort() k = len(vals) v = [x0+t,y0+add([vals[i][2]*t**(i+1) for i in range(k)])] return v
def local_coordinates(self, pt, n): r""" Return local coordinates to precision n at the given point. Behaviour is flaky - some choices of `n` are worst that others. INPUT: - ``pt`` - an F-rational point on X which is not a point of ramification for the projection (x,y) - x. - ``n`` - the number of terms desired OUTPUT: x = x0 + t y = y0 + power series in t EXAMPLES:: sage: FF = FiniteField(5) sage: P2 = ProjectiveSpace(2, FF, names = ['x','y','z']) sage: x, y, z = P2.coordinate_ring().gens() sage: C = Curve(y^2*z^7-x^9-x*z^8) sage: pt = C([2,3,1]) sage: C.local_coordinates(pt,9) # todo: not implemented !!!! [2 + t, 3 + 3*t^2 + t^3 + 3*t^4 + 3*t^6 + 3*t^7 + t^8 + 2*t^9 + 3*t^11 + 3*t^12] """ f = self.defining_polynomial() R = f.parent() F = self.base_ring() p = F.characteristic() x0 = F(pt[0]) y0 = F(pt[1]) astr = ["a" + str(i) for i in range(1, 2 * n)] x, y = R.gens() R0 = PolynomialRing(F, 2 * n + 2, names=[str(x), str(y), "t"] + astr) vars0 = R0.gens() t = vars0[2] yt = y0 * t**0 + add( [vars0[i] * t**(i - 2) for i in range(3, 2 * n + 2)]) xt = x0 + t ft = f(xt, yt) S = singular S.eval('ring s = ' + str(p) + ',' + str(R0.gens()) + ',lp;') S.eval('poly f = ' + str(ft)) cmd = 'matrix c = coeffs (' + str(ft) + ',t)' S.eval(cmd) N = int(S.eval('size(c)')) b = ["c[" + str(i) + ",1]," for i in range(2, N / 2 - 4)] b = ''.join(b) b = b[:len(b) - 1] #to cut off the trailing comma cmd = 'ideal I = ' + b S.eval(cmd) c = S.eval('slimgb(I)') d = c.split("=") d = d[1:] d[len(d) - 1] += "\n" e = [x[:x.index("\n")] for x in d] vals = [] for x in e: for y in vars0: if str(y) in x: if len(x.replace(str(y), "")) != 0: i = x.find("-") if i > 0: vals.append( [eval(x[1:i]), x[:i], F(eval(x[i + 1:]))]) i = x.find("+") if i > 0: vals.append( [eval(x[1:i]), x[:i], -F(eval(x[i + 1:]))]) else: vals.append([eval(str(y)[1:]), str(y), F(0)]) vals.sort() k = len(vals) v = [x0 + t, y0 + add([vals[i][2] * t**(i + 1) for i in range(k)])] return v