def zeta_series(self, n, t): """ Return the zeta series. Compute a power series approximation to the zeta function of a scheme over a finite field. INPUT: - ``n`` -- the number of terms of the power series to compute - ``t`` -- the variable which the series should be returned OUTPUT: A power series approximating the zeta function of self EXAMPLES:: sage: P.<x> = PolynomialRing(GF(3)) sage: C = HyperellipticCurve(x^3+x^2+1) sage: R.<t> = PowerSeriesRing(Integers()) sage: C.zeta_series(4,t) 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5) 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) Note that this function depends on count_points, which is only defined for prime order fields for general schemes. Nonetheless, since :trac:`15108` and :trac:`15148`, it supports hyperelliptic curves over non-prime fields:: sage: C.base_extend(GF(9,'a')).zeta_series(4,t) 1 + 12*t + 120*t^2 + 1092*t^3 + 9840*t^4 + O(t^5) """ F = self.base_ring() if not F.is_finite(): raise TypeError( 'zeta functions only defined for schemes over finite fields') try: a = self.count_points(n) except AttributeError: raise NotImplementedError( 'count_points() required but not implemented') R = PowerSeriesRing(Rationals(), 'u') u = R.gen() temp = sum(a[i - 1] * (u.O(n + 1))**i / i for i in range(1, n + 1)) temp2 = temp.exp() return (temp2(t).O(n + 1))
def zeta_series(self, n, t): """ Return the zeta series. Compute a power series approximation to the zeta function of a scheme over a finite field. INPUT: - ``n`` - the number of terms of the power series to compute - ``t`` - the variable which the series should be returned OUTPUT: A power series approximating the zeta function of self EXAMPLES:: sage: P.<x> = PolynomialRing(GF(3)) sage: C = HyperellipticCurve(x^3+x^2+1) sage: R.<t> = PowerSeriesRing(Integers()) sage: C.zeta_series(4,t) 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5) 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) Note that this function depends on count_points, which is only defined for prime order fields:: sage: C.base_extend(GF(9,'a')).zeta_series(4,t) Traceback (most recent call last): ... NotImplementedError: Point counting only implemented for schemes over prime fields """ F = self.base_ring() if not F.is_finite(): raise TypeError, "Zeta functions only defined for schemes over finite fields" a = self.count_points(n) R = PowerSeriesRing(Rationals(), 'u') u = R.gen() temp = sum(a[i - 1] * (u.O(n + 1))**i / i for i in range(1, n + 1)) temp2 = temp.exp() return (temp2(t).O(n + 1))