Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Eisenstein Series (optimized compiled functions) """
from cysignals.memory cimport check_allocarray, sig_free from cysignals.signals cimport sig_on, sig_off
from sage.rings.rational_field import QQ from sage.rings.power_series_ring import PowerSeriesRing from sage.rings.integer cimport Integer from sage.arith.all import primes, bernoulli from sage.rings.fast_arith cimport prime_range
from cpython.list cimport PyList_GET_ITEM from sage.libs.flint.fmpz_poly cimport * from sage.libs.gmp.mpz cimport * from sage.libs.flint.fmpz_poly cimport Fmpz_poly
cpdef Ek_ZZ(int k, int prec=10): """ Return list of prec integer coefficients of the weight k Eisenstein series of level 1, normalized so the coefficient of q is 1, except that the 0th coefficient is set to 1 instead of its actual value.
INPUT:
- `k` -- int - ``prec`` -- int
OUTPUT:
- list of Sage Integers.
EXAMPLES::
sage: from sage.modular.modform.eis_series_cython import Ek_ZZ sage: Ek_ZZ(4,10) [1, 1, 9, 28, 73, 126, 252, 344, 585, 757] sage: [sigma(n,3) for n in [1..9]] [1, 9, 28, 73, 126, 252, 344, 585, 757] sage: Ek_ZZ(10,10^3) == [1] + [sigma(n,9) for n in range(1,10^3)] True """ cdef Integer pp cdef mpz_t q, current_sum, q_plus_one
cdef unsigned long p cdef Py_ssize_t i, ind cdef bint continue_flag
cdef list power_sum_ls
cdef unsigned long max_power_sum, temp_index cdef unsigned long remainder, prev_index cdef unsigned long additional_p_powers
# allocate the list for the result
# no need to reallocate this list every time -- just reuse the # Integers in it
# NOTE: I (wstein) did benchmarks, and the use of # PyList_GET_ITEM in the code below is worth it since it leads # to a significant speedup by not doing bounds checking.
# set power_sum_ls[1] = q+1
# do the first p-1 q_plus_one)
# now do the pth one, which is harder.
# compute the valuation of n at p
# if we need a new sum, it has to be the next uncomputed one.
max_power_sum))).value,
# finally, set the coefficient additional_p_powers))).value)
cpdef eisenstein_series_poly(int k, int prec = 10) : r""" Return the q-expansion up to precision ``prec`` of the weight `k` Eisenstein series, as a FLINT :class:`~sage.libs.flint.fmpz_poly.Fmpz_poly` object, normalised so the coefficients are integers with no common factor.
Used internally by the functions :func:`~sage.modular.modform.eis_series.eisenstein_series_qexp` and :func:`~sage.modular.modform.vm_basis.victor_miller_basis`; see the docstring of the former for further details.
EXAMPLES::
sage: from sage.modular.modform.eis_series_cython import eisenstein_series_poly sage: eisenstein_series_poly(12, prec=5) 5 691 65520 134250480 11606736960 274945048560 """ cdef mpz_t one, mult, term, last, term_m1, last_m1 cdef unsigned long int expt cdef long ind, ppow, int_p cdef int i
raise ValueError("k (=%s) must be an even positive integer" % k) raise ValueError("prec (=%s) must be an even nonnegative integer" % prec) return Fmpz_poly.__new__(Fmpz_poly)
|