def cyclotomic_to_gamma(cyclo_up, cyclo_down): """ Convert a quotient of products of cyclotomic polynomials to a quotient of products of polynomials `x^n - 1`. INPUT: - ``cyclo_up`` -- list of indices of cyclotomic polynomials in the numerator - ``cyclo_down`` -- list of indices of cyclotomic polynomials in the denominator OUTPUT: a dictionary mapping an integer `n` to the power of `x^n - 1` that appears in the given product EXAMPLES:: sage: from sage.modular.hypergeometric_motive import cyclotomic_to_gamma sage: cyclotomic_to_gamma([6], [1]) {2: -1, 3: -1, 6: 1} """ dico = defaultdict(int) for d in cyclo_up: dico[d] += 1 for d in cyclo_down: dico[d] -= 1 resu = defaultdict(int) for n in dico: for d in divisors(n): resu[d] += moebius(n / d) * dico[n] return {d: resu[d] for d in resu if resu[d]}
def cyclotomic_to_gamma(cyclo_up, cyclo_down): """ Convert a quotient of products of cyclotomic polynomials to a quotient of products of polynomials `x^n - 1`. INPUT: - ``cyclo_up`` -- list of indices of cyclotomic polynomials in the numerator - ``cyclo_down`` -- list of indices of cyclotomic polynomials in the denominator OUTPUT: a dictionary mapping an integer `n` to the power of `x^n - 1` that appears in the given product EXAMPLES:: sage: from sage.modular.hypergeometric_motive import cyclotomic_to_gamma sage: cyclotomic_to_gamma([6], [1]) {2: -1, 3: -1, 6: 1} """ dico = defaultdict(int) for d in cyclo_up: dico[d] += 1 for d in cyclo_down: dico[d] -= 1 resu = defaultdict(int) for n in dico: for d in divisors(n): resu[d] += moebius(n / d) * dico[n] return {d: resu[d] for d in resu if resu[d]}
def capital_M(n): """ Auxiliary function, used to describe the canonical scheme. INPUT: - ``n`` -- an integer OUTPUT: a rational EXAMPLES:: sage: from sage.modular.hypergeometric_motive import capital_M sage: [capital_M(i) for i in range(1,8)] [1, 4, 27, 64, 3125, 432, 823543] """ n = ZZ(n) return QQ.prod(d ** (d * moebius(n / d)) for d in divisors(n))
def capital_M(n): """ Auxiliary function, used to describe the canonical scheme. INPUT: - ``n`` -- an integer OUTPUT: a rational EXAMPLES:: sage: from sage.modular.hypergeometric_motive import capital_M sage: [capital_M(i) for i in range(1,8)] [1, 4, 27, 64, 3125, 432, 823543] """ n = ZZ(n) return QQ.prod(d ** (d * moebius(n / d)) for d in divisors(n))