Opened 13 years ago

Closed 12 years ago

#7458 closed enhancement (fixed)

Sylvester matrix for polynomials

Reported by: carlohamalainen Owned by: malb
Priority: minor Milestone: sage-4.6.2
Component: commutative algebra Keywords: Sylvester matrix
Cc: Merged in: sage-4.6.2.alpha3
Authors: Carlo Hamalainen, Luis Felipe Tabera Alonso Reviewers: David Loeffler
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Small patch to add Sylvester matrix calculation for univariate and multivariate polynomials.

I think that my patch is a bit more general (and has doctests) compared to didier deshommes' patch here, which seems to have never been merged:

http://sage.math.washington.edu/home/dfdeshom/custom/patches/sylveste...

Attachments (3)

sylvester.patch (4.6 KB) - added by carlohamalainen 13 years ago.
trac-7458-sylvester-rebase-4.6.patch (4.6 KB) - added by lftabera 12 years ago.
trac-7458-sylvester-improvements.patch (10.8 KB) - added by lftabera 12 years ago.

Download all attachments as: .zip

Change History (10)

Changed 13 years ago by carlohamalainen

Changed 12 years ago by lftabera

comment:1 Changed 12 years ago by lftabera

  • Authors changed from carlohamalainen to Carlo Hamalainen
  • Keywords Sylvester matrix added
  • Report Upstream set to N/A
  • Status changed from new to needs_work

This is a very basic feature that has to be in Sage.

I have rebased Carlo patch to 4.6 but have not touched the code.

I have some concerns that makes me mark the patch as needs work:

  • The univariate case should accept the same syntax as the multivariate case. In the univariate case, the preferred call is f.sylvester_matrix(g), but I do not want Sage to throw an error if I wrote f.sylvester_matrix(g, x)
  • Corner cases must be well documented.
sage: K.<x>=QQ[]
sage: K(1).sylvester_matrix(K(1))
[]

In particular, I am not sure how to deal with the sylvester matrix of 0 and constant or 0 and 0 Curretly it throws an error. My opinion is that this is not defined but should throw a more meaningful error.

Maple for instance return the empty matrix. So in maple:

Determinant(Sylvester_Matrix) != Resultant

In this corner cases.

I will try to check what other CAS do to get a wider picture.

  • An example explicitly relating Sylvester matrix and resultant should be added.

comment:2 Changed 12 years ago by lftabera

  • I have added more documentation and doctest.
  • The variable argument is now optional in both univariate and multivariate. If it is not used, the first variable of the polynomial ring is used.
  • I have added coercion to be able to compute the Sylvester matrix of polynomials in different rings, for ex. ZZ[x] and QQ[x]
  • solved an issue for the dimension of the matrix of the sylvester matrix of (xn, 0)

It is not ready for review because the sylvester matrix of (0,0) is not implemented.

Changed 12 years ago by lftabera

comment:3 Changed 12 years ago by lftabera

  • Status changed from needs_work to needs_review

Finally, if one of the polynomials is zero, the code raises a ValueError?.

comment:4 Changed 12 years ago by lftabera

  • Authors changed from Carlo Hamalainen to Carlo Hamalainen, Luis Felipe Tabera Alonso

Apply trac-7458-sylvester-rebase-4.6.patch, trac-7458-sylvester-improvements.patch

comment:5 Changed 12 years ago by davidloeffler

  • Reviewers set to David Loeffler
  • Status changed from needs_review to positive_review

Very nice. I am impressed with the thoroughness of the testing of corner cases here. All doctests in sage/rings pass, and the reference manual builds OK.

comment:6 Changed 12 years ago by davidloeffler

  • Milestone changed from sage-4.6.1 to sage-4.6.2
  • Summary changed from [with patch, needs review] Sylvester matrix for polynomials to Sylvester matrix for polynomials

comment:7 Changed 12 years ago by jdemeyer

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