Opened 7 years ago

Closed 7 years ago

#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: Merged in: sage-5.2.beta1
Authors: André Apitzsch Reviewers: Robert Bradshaw
Report Upstream: N/A Work issues:
Branch: Commit:
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 (1)

trac_13187.patch (10.2 KB) - added by aapitzsch 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by aapitzsch

comment:1 Changed 7 years ago by aapitzsch

  • Authors set to André Apitzsch
  • Status changed from new to needs_review

The attached patch fixes the problem and contains some code clean-up.

comment:2 Changed 7 years 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 7 years 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.

comment:4 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.1 to sage-5.2
  • Reviewers set to Robert Bradshaw

comment:5 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.2.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.