@cached_function def E_polynomial(g, n=None): r""" Returns the known values of E_g. If n is specified, return a symmetricp polynomial in variables x0, ..., x(n-1). EXAMPLES:: sage: E_polynomial(0) -e[] sage: E_polynomial(1) 1/12*e[] + 1/12*e[2] sage: E_polynomial(1,1) 1/12 sage: E_polynomial(1,2) 1/12*x0*x1 + 1/12 """ e = SymmetricFunctions(QQ).elementary() if g == 0: result = - e.one() if g == 1: result = 1/12*(e.one() + e[2]) if g == 2: result = -1/240*e.one() + 1/192*e[1, 1] - 1/3840*e[1, 1, 1, 1] - 1/144*e[2] + 1/1440*e[2, 1, 1]\ - 1/360*e[2, 2] + 1/288*e[3, 1] - 1/720*e[4] if g == 3: result = 1/1008*e.one() - 1/768*e[1, 1] + 19/73728*e[1, 1, 1, 1] - 19/4128768*e[1, 1, 1, 1, 1, 1]\ + 1/480*e[2] - 19/23040*e[2, 1, 1] + 19/860160*e[2, 1, 1, 1, 1] + 1/720*e[2, 2] - 1/7680*e[2, 2, 1, 1]\ + 1/3360*e[2, 2, 2] - 7/5760*e[3, 1] + 17/107520*e[3, 1, 1, 1] - 23/40320*e[3, 2, 1] - 1/10080*e[3, 3]\ + 1/1440*e[4] + 11/80640*e[4, 1, 1] + 1/2016*e[4, 2] - 1/2240*e[5, 1] + 1/5040*e[6] if g == 4: # R. = PolynomialRing(QQ) R. = PolynomialRing(QQ) e = SymmetricFunctions(R).elementary() result = -1/1440*e.one() + 5/5184*e[1, 1] - 7/25920*e[1, 1, 1, 1] + 751/40310784*e[1, 1, 1, 1, 1, 1] - 407/2418647040*e[1, 1, 1, 1, 1, 1, 1, 1] - 5/3024*e[2] + 1/1080*e[2, 1, 1] - 751/7838208*e[2, 1, 1, 1, 1] + 407/352719360*e[2, 1, 1, 1, 1, 1, 1] - 1/720*e[2, 2] + 73/217728*e[2, 2, 1, 1] - 89/9797760*e[2, 2, 1, 1, 1, 1] - 1/2016*e[2, 2, 2] + 11/272160*e[2, 2, 2, 1, 1] - 1/15120*e[2, 2, 2, 2] + 1/960*e[3, 1] - 391/1306368*e[3, 1, 1, 1] + 839/78382080*e[3, 1, 1, 1, 1, 1] + 29/36288*e[3, 2, 1] - 103/1306368*e[3, 2, 1, 1, 1] + 31/181440*e[3, 2, 2, 1] + 1/6048*e[3, 3] - 23/362880*e[3, 3, 1, 1] + 1/15120*e[3, 3, 2] - 1/1440*e[4] + (-5/217728)*e[4, 1, 1] + (67/2612736)*e[4, 1, 1, 1, 1] - 5/6048*e[4, 2] + 1/217728*e[4, 2, 1, 1] - 1/4320*e[4, 2, 2] + 1/30240*e[4, 3, 1] - 1/15120*e[4, 4] + (r2-313/181440)*e[5, 1] + (-1/36*r2)*e[5, 1, 1, 1] + 53/181440*e[5, 2, 1] + 1/10080*e[5, 3] - 1/3024*e[6] - 29/362880*e[6, 1, 1] - 1/4320*e[6, 2] + 13/60480*e[7, 1] - 1/10080*e[8] if g > 4: raise ValueError(f'E_{g} not calculated yet') if n is None: return result return result.expand(n)