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
""" Monomial expansion of `(aX + bY)^i (cX + dY)^{j-i}` """
########################################################################## # # Copyright (C) 2008 William Stein <wstein@gmail.com> # # Distributed under the terms of the GNU General Public License (GPL) # # http://www.gnu.org/licenses/ # ##########################################################################
from sage.ext.stdsage cimport PY_NEW
from sage.libs.flint.fmpz_poly cimport * from sage.rings.integer cimport Integer
cdef class Apply: def __cinit__(self): """ EXAMPLES::
sage: import sage.modular.modsym.apply sage: sage.modular.modsym.apply.Apply() <sage.modular.modsym.apply.Apply object at ...> """
def __dealloc__(self): # clear flint polys
cdef int apply_to_monomial_flint(self, fmpz_poly_t ans, int i, int j, int a, int b, int c, int d) except -1: raise ValueError("i (=%s) and j-i (=%s) must both be nonnegative."%(i,j-i))
# f = b+a*x, g = d+c*x
# h = (f**i)*(g**(j-i))
cdef Apply A = Apply()
def apply_to_monomial(int i, int j, int a, int b, int c, int d): r""" Return a list of the coefficients of
.. MATH::
(aX + bY)^i (cX + dY)^{j-i},
where `0 \leq i \leq j`, and `a`, `b`, `c`, `d` are integers.
One should think of `j` as being `k-2` for the application to modular symbols.
INPUT:
- i, j, a, b, c, d -- all ints
OUTPUT:
list of ints, which are the coefficients of `Y^j, Y^{j-1}X, \ldots, X^j`, respectively.
EXAMPLES:
We compute that `(X+Y)^2(X-Y) = X^3 + X^2Y - XY^2 - Y^3`::
sage: from sage.modular.modsym.apply import apply_to_monomial sage: apply_to_monomial(2, 3, 1,1,1,-1) [-1, -1, 1, 1] sage: apply_to_monomial(5, 8, 1,2,3,4) [2048, 9728, 20096, 23584, 17200, 7984, 2304, 378, 27] sage: apply_to_monomial(6,12, 1,1,1,-1) [1, 0, -6, 0, 15, 0, -20, 0, 15, 0, -6, 0, 1] """ cdef fmpz_poly_t pr
cdef Integer res
|