def statistic(self, func, q=None): """ Return .. MATH:: prod_{(d, \lambda)\in \tau} n_\lambda(q^d) where `n_\lambda(q)` is the value returned by ``func`` on the input `\lambda`. INPUT: - ``func`` -- a function that takes a partition to a polynomial in ``q`` - ``q`` -- an integer or an indeterminate EXAMPLES:: sage: tau = SimilarityClassType([[1, [1]], [1, [2, 1]], [2, [1, 1]]]) sage: from sage.combinat.similarity_class_type import fq sage: tau.statistic(lambda la: prod([fq(m) for m in la.to_exp()])) (q^9 - 3*q^8 + 2*q^7 + 2*q^6 - 4*q^5 + 4*q^4 - 2*q^3 - 2*q^2 + 3*q - 1)/q^9 sage: q = ZZ['q'].gen() sage: tau.statistic(lambda la: q**la.size(), q = q) q^8 """ if q is None: q = FractionField(ZZ['q']).gen() return prod([PT.statistic(func, q=q) for PT in self])
def centralizer_group_card(self, q=None): """ Return the cardinality of the centralizer group of a matrix of type ``self`` in a field of order ``q``. INPUT: ``q`` -- an integer or an indeterminate EXAMPLES:: sage: PT = PrimarySimilarityClassType(1, []) sage: PT.centralizer_group_card() 1 sage: PT = PrimarySimilarityClassType(2, [1, 1]) sage: PT.centralizer_group_card() q^8 - q^6 - q^4 + q^2 """ if q == None: R = FractionField(ZZ['q']) q = R.gen() return self.statistic(centralizer_group_cardinality, q=q)
def mod5family(a, b): """ Formulas for computing the family of elliptic curves with congruent mod-5 representation. EXAMPLES:: sage: from sage.schemes.elliptic_curves.mod5family import mod5family sage: mod5family(0,1) Elliptic Curve defined by y^2 = x^3 + (t^30+30*t^29+435*t^28+4060*t^27+27405*t^26+142506*t^25+593775*t^24+2035800*t^23+5852925*t^22+14307150*t^21+30045015*t^20+54627300*t^19+86493225*t^18+119759850*t^17+145422675*t^16+155117520*t^15+145422675*t^14+119759850*t^13+86493225*t^12+54627300*t^11+30045015*t^10+14307150*t^9+5852925*t^8+2035800*t^7+593775*t^6+142506*t^5+27405*t^4+4060*t^3+435*t^2+30*t+1) over Fraction Field of Univariate Polynomial Ring in t over Rational Field """ J = 4 * a**3 / (4 * a**3 + 27 * b**2) alpha = [0 for _ in range(21)] alpha[0] = 1 alpha[1] = 0 alpha[2] = 190 * (J - 1) alpha[3] = -2280 * (J - 1)**2 alpha[4] = 855 * (J - 1)**2 * (-17 + 16 * J) alpha[5] = 3648 * (J - 1)**3 * (17 - 9 * J) alpha[6] = 11400 * (J - 1)**3 * (17 - 8 * J) alpha[7] = -27360 * (J - 1)**4 * (17 + 26 * J) alpha[8] = 7410 * (J - 1)**4 * (-119 - 448 * J + 432 * J**2) alpha[9] = 79040 * (J - 1)**5 * (17 + 145 * J - 108 * J**2) alpha[10] = 8892 * (J - 1)**5 * (187 + 2640 * J - 5104 * J**2 + 1152 * J**3) alpha[11] = 98800 * (J - 1)**6 * (-17 - 388 * J + 864 * J**2) alpha[12] = 7410 * (J - 1)**6 * (-187 - 6160 * J + 24464 * J**2 - 24192 * J**3) alpha[13] = 54720 * (J - 1)**7 * (17 + 795 * J - 3944 * J**2 + 9072 * J**3) alpha[14] = 2280 * (J - 1)**7 * (221 + 13832 * J - 103792 * J**2 + 554112 * J**3 - 373248 * J**4) alpha[15] = 1824 * (J - 1)**8 * (-119 - 9842 * J + 92608 * J**2 - 911520 * J**3 + 373248 * J**4) alpha[16] = 4275 * (J - 1)**8 * (-17 - 1792 * J + 23264 * J**2 - 378368 * J**3 + 338688 * J**4) alpha[17] = 18240 * (J - 1)**9 * (1 + 133 * J - 2132 * J**2 + 54000 * J**3 - 15552 * J**4) alpha[18] = 190 * (J - 1)**9 * (17 + 2784 * J - 58080 * J**2 + 2116864 * J**3 - 946944 * J**4 + 2985984 * J**5) alpha[19] = 360 * (J - 1)**10 * (-1 + 28 * J - 1152 * J**2) * ( 1 + 228 * J + 176 * J**2 + 1728 * J**3) alpha[20] = (J - 1)**10 * (-19 - 4560 * J + 144096 * J**2 - 9859328 * J**3 - 8798976 * J**4 - 226934784 * J**5 + 429981696 * J**6) beta = [0 for _ in range(31)] beta[0] = 1 beta[1] = 30 beta[2] = -435 * (J - 1) beta[3] = 580 * (J - 1) * (-7 + 9 * J) beta[4] = 3915 * (J - 1)**2 * (7 - 8 * J) beta[5] = 1566 * (J - 1)**2 * (91 - 78 * J + 48 * J**2) beta[6] = -84825 * (J - 1)**3 * (7 + 16 * J) beta[7] = 156600 * (J - 1)**3 * (-13 - 91 * J + 92 * J**2) beta[8] = 450225 * (J - 1)**4 * (13 + 208 * J - 144 * J**2) beta[9] = 100050 * (J - 1)**4 * (143 + 4004 * J - 5632 * J**2 + 1728 * J**3) beta[10] = 30015 * (J - 1)**5 * (-1001 - 45760 * J + 44880 * J**2 - 6912 * J**3) beta[11] = 600300 * (J - 1)**5 * (-91 - 6175 * J + 9272 * J**2 - 2736 * J**3) beta[12] = 950475 * (J - 1)**6 * (91 + 8840 * J - 7824 * J**2) beta[13] = 17108550 * (J - 1)**6 * (7 + 926 * J - 1072 * J**2 + 544 * J**3) beta[14] = 145422675 * (J - 1)**7 * (-1 - 176 * J + 48 * J**2 - 384 * J**3) beta[15] = 155117520 * (J - 1)**8 * (1 + 228 * J + 176 * J**2 + 1728 * J**3) beta[16] = 145422675 * (J - 1)**8 * (1 + 288 * J + 288 * J**2 + 5120 * J**3 - 6912 * J**4) beta[17] = 17108550 * (J - 1)**8 * (7 + 2504 * J + 3584 * J**2 + 93184 * J**3 - 283392 * J**4 + 165888 * J**5) beta[18] = 950475 * (J - 1)**9 * (-91 - 39936 * J - 122976 * J**2 - 2960384 * J**3 + 11577600 * J**4 - 5971968 * J**5) beta[19] = 600300 * (J - 1)**9 * (-91 - 48243 * J - 191568 * J**2 - 6310304 * J**3 + 40515072 * J**4 - 46455552 * J**5 + 11943936 * J**6) beta[20] = 30015 * (J - 1)**10 * (1001 + 634920 * J + 3880800 * J**2 + 142879744 * J**3 - 1168475904 * J**4 + 1188919296 * J**5 - 143327232 * J**6) beta[21] = 100050 * (J - 1)**10 * (143 + 107250 * J + 808368 * J**2 + 38518336 * J**3 - 451953408 * J**4 + 757651968 * J**5 - 367276032 * J**6) beta[22] = 450225 * (J - 1)**11 * (-13 - 11440 * J - 117216 * J**2 - 6444800 * J**3 + 94192384 * J**4 - 142000128 * J**5 + 95551488 * J**6) beta[23] = 156600 * (J - 1)**11 * ( -13 - 13299 * J - 163284 * J**2 - 11171552 * J**3 + 217203840 * J**4 - 474406656 * J**5 + 747740160 * J**6 - 429981696 * J**7) beta[24] = 6525*(J - 1)**12*(91 + 107536*J + 1680624*J**2 + 132912128*J**3 -\ 3147511552*J**4 + 6260502528*J**5 - 21054173184*J**6 + 10319560704*J**7) beta[25] = 1566*(J - 1)**12*(91 + 123292*J + 2261248*J**2 + 216211904*J**3 - \ 6487793920*J**4 + 17369596928*J**5 - 97854234624*J**6 + 96136740864*J**7 - 20639121408*J**8) beta[26] = 3915*(J - 1)**13*(-7 - 10816*J - 242352*J**2 - 26620160*J**3 + 953885440*J**4 - \ 2350596096*J**5 + 26796552192*J**6 - 13329432576*J**7) beta[27] = 580*(J - 1)**13*(-7 - 12259*J - 317176*J**2 - 41205008*J**3 + \ 1808220160*J**4 - 5714806016*J**5 + 93590857728*J**6 - 70131806208*J**7 - 36118462464*J**8) beta[28] = 435*(J - 1)**14*(1 + 1976*J + 60720*J**2 + 8987648*J**3 - 463120640*J**4 + 1359157248*J**5 - \ 40644882432*J**6 - 5016453120*J**7 + 61917364224*J**8) beta[29] = 30*(J - 1)**14*(1 + 2218*J + 77680*J**2 + 13365152*J**3 - \ 822366976*J**4 + 2990693888*J**5 - 118286217216*J**6 - 24514928640*J**7 + 509958291456*J**8 - 743008370688*J**9) beta[30] = (J - 1)**15*(-1 - 2480*J - 101040*J**2 - 19642496*J**3 + 1399023872*J**4 - \ 4759216128*J**5 + 315623485440*J**6 + 471904911360*J**7 - 2600529297408*J**8 + 8916100448256*J**9) R = PolynomialRing(QQ, 't') b4 = a * R(alpha) b6 = b * R(beta) c2 = b4 c3 = b6 d = lcm(c2.denominator(), c3.denominator()) F = FractionField(R) E = EllipticCurve(F, [c2 * d**4, c3 * d**6]) return E
def rational_type(f, n=ZZ(3), base_ring=ZZ): r""" Return the basic analytic properties that can be determined directly from the specified rational function ``f`` which is interpreted as a representation of an element of a FormsRing for the Hecke Triangle group with parameter ``n`` and the specified ``base_ring``. In particular the following degree of the generators is assumed: `deg(1) := (0, 1)` `deg(x) := (4/(n-2), 1)` `deg(y) := (2n/(n-2), -1)` `deg(z) := (2, -1)` The meaning of homogeneous elements changes accordingly. INPUT: - ``f`` -- A rational function in ``x,y,z,d`` over ``base_ring``. - ``n`` -- An integer greater or equal to `3` corresponding to the ``HeckeTriangleGroup`` with that parameter (default: `3`). - ``base_ring`` -- The base ring of the corresponding forms ring, resp. polynomial ring (default: ``ZZ``). OUTPUT: A tuple ``(elem, h**o, k, ep, analytic_type)`` describing the basic analytic properties of `f` (with the interpretation indicated above). - ``elem`` -- ``True`` if `f` has a homogeneous denominator. - ``h**o`` -- ``True`` if `f` also has a homogeneous numerator. - ``k`` -- ``None`` if `f` is not homogeneous, otherwise the weight of `f` (which is the first component of its degree). - ``ep`` -- ``None`` if `f` is not homogeneous, otherwise the multiplier of `f` (which is the second component of its degree) - ``analytic_type`` -- The ``AnalyticType`` of `f`. For the zero function the degree `(0, 1)` is choosen. This function is (heavily) used to determine the type of elements and to check if the element really is contained in its parent. EXAMPLES:: sage: from sage.modular.modform_hecketriangle.constructor import rational_type sage: (x,y,z,d) = var("x,y,z,d") sage: rational_type(0, n=4) (True, True, 0, 1, zero) sage: rational_type(1, n=12) (True, True, 0, 1, modular) sage: rational_type(x^3 - y^2) (True, True, 12, 1, cuspidal) sage: rational_type(x * z, n=7) (True, True, 14/5, -1, quasi modular) sage: rational_type(1/(x^3 - y^2) + z/d) (True, False, None, None, quasi weakly holomorphic modular) sage: rational_type(x^3/(x^3 - y^2)) (True, True, 0, 1, weakly holomorphic modular) sage: rational_type(1/(x + z)) (False, False, None, None, None) sage: rational_type(1/x + 1/z) (True, False, None, None, quasi meromorphic modular) sage: rational_type(d/x, n=10) (True, True, -1/2, 1, meromorphic modular) sage: rational_type(1.1 * z * (x^8-y^2), n=8, base_ring=CC) (True, True, 22/3, -1, quasi cuspidal) sage: rational_type(x-y^2, n=infinity) (True, True, 4, 1, modular) sage: rational_type(x*(x-y^2), n=infinity) (True, True, 8, 1, cuspidal) sage: rational_type(1/x, n=infinity) (True, True, -4, 1, weakly holomorphic modular) """ from .analytic_type import AnalyticType AT = AnalyticType() # Determine whether f is zero if (f == 0): # elem, h**o, k, ep, analytic_type return (True, True, QQ(0), ZZ(1), AT([])) analytic_type = AT(["quasi", "mero"]) R = PolynomialRing(base_ring, 'x,y,z,d') F = FractionField(R) (x, y, z, d) = R.gens() R2 = PolynomialRing(PolynomialRing(base_ring, 'd'), 'x,y,z') dhom = R.hom(R2.gens() + (R2.base().gen(), ), R2) f = F(f) num = R(f.numerator()) denom = R(f.denominator()) ep_num = set([ ZZ(1) - 2 * ((sum([g.exponents()[0][m] for m in [1, 2]])) % 2) for g in dhom(num).monomials() ]) ep_denom = set([ ZZ(1) - 2 * ((sum([g.exponents()[0][m] for m in [1, 2]])) % 2) for g in dhom(denom).monomials() ]) if (n == infinity): hom_num = R(num.subs(x=x**4, y=y**2, z=z**2)) hom_denom = R(denom.subs(x=x**4, y=y**2, z=z**2)) else: n = ZZ(n) hom_num = R(num.subs(x=x**4, y=y**(2 * n), z=z**(2 * (n - 2)))) hom_denom = R(denom.subs(x=x**4, y=y**(2 * n), z=z**(2 * (n - 2)))) # Determine whether the denominator of f is homogeneous if (len(ep_denom) == 1 and dhom(hom_denom).is_homogeneous()): elem = True else: # elem, h**o, k, ep, analytic_type return (False, False, None, None, None) # Determine whether f is homogeneous if (len(ep_num) == 1 and dhom(hom_num).is_homogeneous()): h**o = True if (n == infinity): weight = (dhom(hom_num).degree() - dhom(hom_denom).degree()) else: weight = (dhom(hom_num).degree() - dhom(hom_denom).degree()) / (n - 2) ep = ep_num.pop() / ep_denom.pop() # TODO: decompose f (resp. its degrees) into homogeneous parts else: h**o = False weight = None ep = None # Note that we intentionally leave out the d-factor! if (n == infinity): finf_pol = (x - y**2) else: finf_pol = x**n - y**2 # Determine whether f is modular if not ((num.degree(z) > 0) or (denom.degree(z) > 0)): analytic_type = analytic_type.reduce_to("mero") # Determine whether f is holomorphic if (dhom(denom).is_constant()): analytic_type = analytic_type.reduce_to(["quasi", "holo"]) # Determine whether f is cuspidal in the sense that finf divides it... # Bug in singular: finf_pol.divides(1.0) fails over RR if (not dhom(num).is_constant() and finf_pol.divides(num)): if (n != infinity or x.divides(num)): analytic_type = analytic_type.reduce_to(["quasi", "cusp"]) else: # -> Because of a bug with singular in some cases try: while (finf_pol.divides(denom)): # a simple "denom /= finf_pol" is strangely not enough for non-exact rings # and dividing would/may result with an element of the quotient ring of the polynomial ring denom = denom.quo_rem(finf_pol)[0] denom = R(denom) if (n == infinity): while (x.divides(denom)): # a simple "denom /= x" is strangely not enough for non-exact rings # and dividing would/may result with an element of the quotient ring of the polynomial ring denom = denom.quo_rem(x)[0] denom = R(denom) except TypeError: pass # Determine whether f is weakly holomorphic in the sense that at most powers of finf occur in denom if (dhom(denom).is_constant()): analytic_type = analytic_type.reduce_to(["quasi", "weak"]) return (elem, h**o, weight, ep, analytic_type)