Ask Your Question

Compute determinant of matrix of Schur functions using Kronecker product

asked 2020-08-02 00:43:12 -0500

Xie gravatar image

updated 2020-08-02 13:43:18 -0500

slelievre gravatar image

Given a matrix $m=(a_{i,j})$, where each $a_{i,j}$ is a Schur function, by default, m.det() will give the determinant using the original multiplication.

But I want it to use the Kronecker product for Schur functions.

I did not find any options to set the Kronecker product as default multiplication operator in the ring of Schur functions or in the matrix class.

To give an example, let us define such a matrix:

sage: Sym = SymmetricFunctions(QQ)
sage: s = Sym.schur()
sage: f = s[2]

sage: m = matrix([[f, 0], [0, f]])
sage: m
[s[2]    0]
[   0 s[2]]

Then compare:

sage: m.det()
s[2, 2] + s[3, 1] + s[4]

sage: f * f
s[2, 2] + s[3, 1] + s[4]

sage: f.kronecker_product(f)
edit retag flag offensive close merge delete


Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2020-08-02 05:51:22 -0500 )edit

I edited your question to add a simple example of such a matrix, of size two by two.

This way others can copy and paste in a fresh Sage session to explore the question.

This increases the chances and the speed of an answer.

slelievre gravatar imageslelievre ( 2020-08-02 13:45:02 -0500 )edit

Does the example I added adequately illustrate the question? Otherwise please edit.

slelievre gravatar imageslelievre ( 2020-08-03 08:06:34 -0500 )edit

Yeah, you are right.

Xie gravatar imageXie ( 2020-08-10 21:40:20 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-08-02 14:51:28 -0500

slelievre gravatar image

updated 2020-08-02 18:01:41 -0500

Here is a function kdet that will compute the determinant as desired.

It works by creating a copy of the matrix, redefining the _mul_ method of its elements as kronecker_product, and computing the determinant of that matrix.

This does not completely answer the question, since the "Kronecker product determinant" of a matrix a has to be computed as kdet(a) rather than a.det().

Here is the proposed function kdet:

def kdet(a):
    Return the "Kronecker product determinant" of the matrix `a`.

    That is, compute the determinant of `a` as usual except
    multiplying entries using the Kronecker product.
    nr = a.nrows()
    nc = a.ncols()
    R = a.base_ring()
    z =
    aa = a.list()
    mci = lambda e: e.monomial_coefficients().items()
    new = lambda e: sum((c * R(m) for m, c in mci(e)), z)
    bb = [new(e) for e in aa]
    for e in bb:
        e._mul_ = e.kronecker_product
    b = matrix(R, nr, nc, bb)
    return b.det()


sage: S = SymmetricFunctions(QQ)
sage: s = S.schur()

sage: f = s[2]

sage: a = matrix([[f, 0], [0, f]])
sage: a
[s[2]    0]
[   0 s[2]]

sage: a.det()
s[2, 2] + s[3, 1] + s[4]

sage: det(a)
s[2, 2] + s[3, 1] + s[4]

sage: kdet(a)


sage: f * f
s[2, 2] + s[3, 1] + s[4]

sage: f.kronecker_product(f)

To go further and enable using a.det, one is tempted to define a method _matrix_determinant for the ring s using kdet, but since kdet uses det, this leads to a recursion error.

sage: s._matrix_determinant = kdet
sage: a = matrix([[f, 0], [0, f]])
sage: a.det()
Traceback (most recent call last)
RecursionError: maximum recursion depth exceeded while calling a Python object

Hopefully the workaround provided by the function kdet is still useful.

edit flag offensive delete link more


This answer is wonderful. Thank you!

Xie gravatar imageXie ( 2020-08-10 21:42:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-08-02 00:43:12 -0500

Seen: 117 times

Last updated: Aug 02