Ticket #13187 (closed defect: fixed)
Minpoly and charpoly don't check their arguments correctly
| Reported by: | Snark | Owned by: | jason, was |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-5.2 |
| Component: | linear algebra | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | Robert Bradshaw |
| Authors: | André Apitzsch | Merged in: | sage-5.2.beta1 |
| Dependencies: | Stopgaps: |
Description
The following fails in sage (likewise with charpoly):
k=CyclotomicField(10)
U=matrix(k, 1,1,[1])
var('t')
U.minpoly(t)
The error is in a call that the function makes to PolynomialRing? :
TypeError: invalid input (Cyclotomic Field of order 10 and degree 4, t, None) to PolynomialRing function; please see the docstring for that function
Strangely, if you use :
k=CyclotomicField(10)
U=matrix(k, 1,1,[1])
var('t')
U.minpoly('t')
everything is fine.
In any case, I would expect charpoly/minpoly to complain themselves if I don't call them correctly (which isn't clear at all!) -- it's definitely not normal (and upsetting for newbies) that another function reacts.
This is with sage-5.1.beta6.
Attachments
Change History
comment:1 Changed 12 months ago by aapitzsch
- Status changed from new to needs_review
- Authors set to André Apitzsch
The attached patch fixes the problem and contains some code clean-up.
comment:2 Changed 12 months ago by Snark
Eh, just moving that piece of code around is enough? Good!
Five hours between the report and the patch? Excellent!
Thanks!
comment:3 Changed 12 months ago by robertwb
- Status changed from needs_review to positive_review
Yep, that looks like a good fix to me. Lots of style changes (improvements) in this patch as well, but that's fine.

