Ticket #2654 (closed defect: fixed)
[with patch; with positive review] Cyclotomic polynomials speed
| Reported by: | cremona | Owned by: | robertwb |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-3.0 |
| Component: | commutative algebra | Keywords: | cyclotomic polynomial |
| Cc: | rlb | Author(s): | |
| Report Upstream: | Reviewer(s): | ||
| Merged in: | Work issues: |
Description
The current implementation of cyclotomic polynomials in sage/rings/polynomial/cyclotomic.pyx uses the Mobius inversion formula.
I think it would be more efficient to use the recursion
\Phi_{p*n}(X) = \Phi_n(X^p) # if p|n
= \Phi_n(X^p)/\Phi_n(X) # else
(though probably not implemented recursively). This would be simpler than what is currently done, and it would be worth implementing this to see if was really faster.
Secondly, it would be easy to implement a function is_cyclotomic() using the algorithm of Smyth and Beukers. This could just return True/False, or even n if the input is the n'th cyclotomic poly. One application would be to improve the function multiplicative_order() for elements of number fields (and more general algebras), by checking if the minimal poly is cyclotomic. There are a couple of TODOs in sage.rings.number_field.number_field_element which this would address (the algorithm there describes itself as "very dumb" and it is hard to disagree!).

