Opened 9 years ago

Closed 9 years ago

# Bug in product of Schur symmetric functions

Reported by: Owned by: zabrocki critical sage-5.13 combinatorics symmetrica, lrcalc, symmetric functions sage-combinat, aschilling, asbuch, mguaypaq, saliola, darij, tfeulner sage-5.13.beta3 Mike Zabrocki Anne Schilling Reported upstream. Developers acknowledge bug.

### Description

For partitions with first part >123 the product of Schur functions has problems.

```sage: s = SymmetricFunctions(QQ).s()
sage: s[121,1]*s[2,1] # ok
s[121, 2, 1, 1] + s[121, 2, 2] + s[121, 3, 1] + s[122, 1, 1, 1] + 2*s[122, 2, 1] + s[122, 3] + s[123, 1, 1] + s[123, 2]
sage: s[122,1]*s[2,1] # not ok
2*s[1]
```

### comment:1 Changed 9 years ago by zabrocki

This bug was reported to me by Mercedes Rosas. I haven't experimented yet to identify the problem precisely.

Since the product of Schur functions is done with lrcalc (which may or may not be where the bug is) I included Anders Buch in the cc of the developers list (this is the 'report upstream').

### comment:2 Changed 9 years ago by zabrocki

Remark:

I do not have similarly incorrect answers with the product of monomial symmetric functions.

```sage: m = SymmetricFunctions(QQ).m()
sage: m[122,1]*m[2,1]
2*m[122, 2, 1, 1] + 2*m[122, 2, 2] + m[122, 3, 1] + m[123, 2, 1] + m[123, 3] + 2*m[124, 1, 1] + m[124, 2]
sage: m[600,1]*m[2,1]
2*m[600, 2, 1, 1] + 2*m[600, 2, 2] + m[600, 3, 1] + m[601, 2, 1] + m[601, 3] + 2*m[602, 1, 1] + m[602, 2]
```

### comment:3 Changed 9 years ago by zabrocki

• Summary changed from Bug in product of symmetric functions to Bug in product of Schur symmetric functions

### comment:4 Changed 9 years ago by zabrocki

My first test indicates that the bug does not lie in lrcalc, but is actually a problem in symmetrica.

```sage: s = SymmetricFunctions(QQ).s()
sage: symmetrica.mult_schur_schur(s[122,1],s[2,1])
2*s[1]
```

### comment:5 Changed 9 years ago by zabrocki

• Report Upstream changed from Reported upstream. No feedback yet. to N/A

### comment:6 follow-up: ↓ 11 Changed 9 years ago by zabrocki

One fix for this bug could be to switch the product from symmetrica to lrcalc since the problem seems to be within symmetrica:

```sage: import sage.libs.lrcalc.lrcalc as lrcalc
sage: sage.libs.lrcalc.lrcalc.mult([122,1],[2,1])
{[122, 2, 1, 1]: 1,
[122, 2, 2]: 1,
[122, 3, 1]: 1,
[123, 1, 1, 1]: 1,
[123, 2, 1]: 2,
[123, 3]: 1,
[124, 1, 1]: 1,
[124, 2]: 1}
```

lrcalc seems to have a known reported bug in #14625 (to my eye, significantly less serious). Any advice?

### comment:7 Changed 9 years ago by zabrocki

You can test the symmetrica bug is also triggered on the website for symmetrica at this link. Enter `[1,122]` and `[1,2]` and the same bug appears. I suppose in any case it is worth digging around again in the symmetrica code to identify the problem.

### comment:8 Changed 9 years ago by zabrocki

• Report Upstream changed from N/A to Reported upstream. No feedback yet.

An email message was sent to the addresses at the website for symmetrica as well as to Axel Kohnert (Nicolas indicated that he might be a contact for symmetrica).

### comment:11 in reply to: ↑ 6 Changed 9 years ago by aschilling

Wow, this is a terrible bug!!! One option would be to do the computations using lrcalc since we already have an interface to it and in addition ask Anders Buch to try to fix the lrcalc bug reported in #14625.

### comment:12 Changed 9 years ago by zabrocki

• Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.

I am not sure if "Developers acknowledge bug." is quite accurate, but will have to do for now. Axel Kohnert has been seriously hurt and is unconscious. Adalbert Kerber from Bayreuth acknowledged the bug report though.

I am posting here a patch to change the multiplication from symmetrica to lrcalc. I don't consider it quite ready for review, but it seems to solve the problem. As a happy side effect it also seems to have a serious speedup.

```sage: s = SymmetricFunctions(QQ).s()
sage: P = list(reversed(range(1,8)))
sage: %time s(P)*s(P);
```

has a speedup from 169.30s to 27.75s running on sage cloud.

### comment:13 Changed 9 years ago by zabrocki

Doing some more experimenting I have found minor modifications of how to trigger the bug and the second example has very bad behavior:

```sage: s[123,1]*s[1,1]
2*s[1]
sage: s[123]*s[2,1]
ValueError                                Traceback (most recent call last)
...
ValueError: [0, 0, ..., 0, 122, 2, 1] is not an element of Partitions
```

### comment:14 Changed 9 years ago by zabrocki

I guess I shouldn't have stopped there because:

```sage: s([125])*s([3])
RuntimeError                              Traceback (most recent call last)
...
RuntimeError: Segmentation fault
```

### comment:15 Changed 9 years ago by zabrocki

I don't see the fix for symmetrica. There is clearly a bug there that one can recreate on their website.

The attached patch changes `_multiply` to `_multiply_basis` and then calls `lrcalc.mult`. I believe that given what the former `_multiply` function did, it should have been a `_multiply_basis` all along. I also added three doctests.

That does not mean that the bug in symmetrica should not be fixed. The following command causes a `Segmentation fault`

```sage: symmetrica.mult_schur_schur([125],[3])
```

My recommendation is to review this patch and move on to fixing the problems with lrcalc mentioned in #14625. Anders Buch has a version 1.1.7 of lrcalc while the version in Sage now is 1.1.6.

### comment:16 Changed 9 years ago by zabrocki

• Status changed from new to needs_review

### comment:17 Changed 9 years ago by zabrocki

• Keywords symmetrica lrcalc symmetric functions added

### comment:18 follow-up: ↓ 19 Changed 9 years ago by zabrocki

• Authors set to Mike Zabrocki

### comment:19 in reply to: ↑ 18 Changed 9 years ago by aschilling

The fix looks good to me!

### comment:20 Changed 9 years ago by aschilling

• Reviewers set to Anne Schilling
• Status changed from needs_review to positive_review

### comment:21 Changed 9 years ago by zabrocki

The bug in symmetrica was moved to ticket #15407

### comment:22 Changed 9 years ago by jdemeyer

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