Interface to Singular, symmetric powers

51 views
Skip to first unread message

Chris Brav

unread,
May 22, 2017, 8:34:55 AM5/22/17
to sage-support
I'd like to be able to compute symmetric powers of matrices in Sage. Singular has a function for the kth symmetric power of a matrix A, namely symmetricPower(A,k) (https://www.singular.uni-kl.de/Manual/4-0-3/sing_1107.htm#SEC1182). So it seems one should just take a Sage matrix, convert it to a singular matrix, take its symmetric power, and then convert back. I tried singular.symmetricPower(A._singular_(),k) for A a Sage matrix, but the interface complains that A is not of the correct type. It seems that A._singular_() should be a matrix over a specified ring, and ._singular_() doesn't create that ring. Any suggestions?

Dima Pasechnik

unread,
May 22, 2017, 11:36:15 AM5/22/17
to sage-support
it's a good plan, unless your A has exotic entries, so that a Singular polynomial ring with coefficients in this ring cannot be made. E.g. the following works:

sage: R.<x,y>=QQ[]
sage: A=matrix(R,[[1,2],[3,4]])
sage: singular.symmetricPower(A._singular_(),3).sage()

[64 48 36 27]
[96 64 42 27]
[48 28 16  9]
[ 8  4  2  1]

Chris Brav

unread,
May 23, 2017, 3:17:41 AM5/23/17
to sage-support
Thanks. It seems that indeed some rings, such as ZZ and QQ, are too exotic for Singular, and that you really have to base change to a polynomial ring over a field. Here is a little function definition which seems to work for any matrix defined over a domain:

def sympow(A,d):

R=A.base_ring()
F=FractionField(R)
S.<q>=F[]
A=A.change_ring(S)

return singular.symmetricPower(A._singular_(),d).sage().change_ring(R)


Chris Brav

unread,
May 23, 2017, 5:09:40 AM5/23/17
to sage-support
Caution to those who want to use this: Singular produces a symmetric power matrix in a basis that is the reverse of what you (or at least I) might expect. Which basis Singular chooses is clear if you test it on a diagonal matrix with variables as entries.

Dima Pasechnik

unread,
May 23, 2017, 6:48:24 AM5/23/17
to sage-support


On Tuesday, May 23, 2017 at 8:17:41 AM UTC+1, Chris Brav wrote:
Thanks. It seems that indeed some rings, such as ZZ and QQ, are too exotic for Singular,

this is a limitation of Singular - it appears that any ring in Singular must be either a polynomial ring or something derived from it, e.g. a quotient...
Reply all
Reply to author
Forward
0 new messages