I have some very strange behaviour of a substitution, which I don't know how to reproduce, but it happens from time to time, and is REALLY disturbing. I don't even know what to write into a ticket, so I'm asking here first. The definition of CSP is at the end of the mail.
sage: R.<q> = ZZ[] sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 + q^12 + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 + 2*q^3 + 2*q^2 + 3*q + 4 sage: p == CSP(22) True sage: CSP(22).subs({q:QQbar.zeta(2)}) -28 sage: CSP(22).subs({q:QQbar.zeta(2)}) 2 sage: CSP(22).parent() Univariate Polynomial Ring in q over Integer Ring Sometimes I also get a complex number. Martin ################### def cycle_power(g, e): """ Return k such that g^k = e """ if e.is_one(): return 0 k = 1 p = g while True: if e == p: return k p *= g k += 1 @cached_function def CSP(n): C = groups.permutation.Cyclic(n) g = C.gen() R.<q> = ZZ[] return sum(q^min(cycle_power(g, e) for e in coset) for H in C.subgroups() for coset in C.cosets(H)) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/a013e022-a007-4748-9a67-ae1e45f3e825n%40googlegroups.com.