Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrects some inner products in root systems #38750

Merged
merged 11 commits into from
Oct 12, 2024

Conversation

skipgaribaldi
Copy link
Contributor

Goal of this PR:

Status quo:

  • Some inner products for elements of root spaces or ambient spaces give wrong answers or raise exceptions

Fix:

  • Adds a few lines of code to scalar product functions in ambient_space and root_space
  • TESTS were added to scalar product member functions to exhibit fixing this issue

Notes:

  • I am unable to verify that the documentation builds because I cannot build the documentation (build problems with this version of Sage)

A more thorough test of this functionality, which checks Exhibit A from the issue on more cases, is provided by the following code snippet:

for ct in [['G', 2], ['F', 4], ['E', 8], ['E', 7]] + [[x, 6] for x in ['A', 'B', 'C', 'D', 'E']]:     
    rt = RootSystem(ct)
    print(ct)
    lat = rt.root_lattice()
    spc = rt.ambient_space()
    ell = lat.rank()
    C = rt.cartan_matrix()
    for i in range(1,ell+1):
        assert lat.simple_root(i) == spc.simple_root(i)
        assert lat.simple_coroot(i) == spc.simple_coroot(i)
        for j in range(1,ell+1):
            aprod = C[j-1,i-1]
            assert lat.simple_root(i).scalar(lat.simple_coroot(j)) == aprod
            assert spc.simple_root(i).scalar(spc.simple_coroot(j)) == aprod
            assert spc.simple_root(i).scalar(lat.simple_coroot(j)) == aprod
            assert lat.simple_root(i).scalar(spc.simple_coroot(j)) == aprod

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the improvements here. It is good to not require the user to be so explicit. Here are some improvements based on your PR.

src/sage/combinat/root_system/root_space.py Outdated Show resolved Hide resolved
src/sage/combinat/root_system/root_space.py Outdated Show resolved Hide resolved
src/sage/combinat/root_system/root_space.py Outdated Show resolved Hide resolved
continue
result += c*self_mc[t]
return result
raise TypeError(f"Don't know how to coerce {lambdacheck} into root or coroot space of {self}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise TypeError(f"Don't know how to coerce {lambdacheck} into root or coroot space of {self}")

src/sage/combinat/root_system/ambient_space.py Outdated Show resolved Hide resolved
src/sage/combinat/root_system/ambient_space.py Outdated Show resolved Hide resolved
src/sage/combinat/root_system/ambient_space.py Outdated Show resolved Hide resolved
skipgaribaldi and others added 7 commits October 1, 2024 18:51
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Copy link

github-actions bot commented Oct 2, 2024

Documentation preview for this PR (built with commit e08bb52; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed one doc-formatting thing. Once fixed, this will be a positive review.

src/sage/combinat/root_system/root_space.py Outdated Show resolved Hide resolved
@tscrim
Copy link
Collaborator

tscrim commented Oct 4, 2024

Thank you.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 5, 2024
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Goal of this PR:
   * Fix Exhibit A in sagemath#15325
   * Exhibits B and C in the issue are ignored because they are not
strictly speaking errors

Status quo:
   * Some inner products for elements of root spaces or ambient spaces
give wrong answers or raise exceptions

Fix:
   * Adds a few lines of code to scalar product functions in
ambient_space and root_space
   * TESTS were added to scalar product member functions to exhibit
fixing this issue

Notes:
   * I am unable to verify that the documentation builds because I
cannot build the documentation (build problems with this version of
Sage)

A more thorough test of this functionality, which checks Exhibit A from
the issue on more cases, is provided by the following code snippet:

```
for ct in [['G', 2], ['F', 4], ['E', 8], ['E', 7]] + [[x, 6] for x in
['A', 'B', 'C', 'D', 'E']]:
    rt = RootSystem(ct)
    print(ct)
    lat = rt.root_lattice()
    spc = rt.ambient_space()
    ell = lat.rank()
    C = rt.cartan_matrix()
    for i in range(1,ell+1):
        assert lat.simple_root(i) == spc.simple_root(i)
        assert lat.simple_coroot(i) == spc.simple_coroot(i)
        for j in range(1,ell+1):
            aprod = C[j-1,i-1]
            assert lat.simple_root(i).scalar(lat.simple_coroot(j)) ==
aprod
            assert spc.simple_root(i).scalar(spc.simple_coroot(j)) ==
aprod
            assert spc.simple_root(i).scalar(lat.simple_coroot(j)) ==
aprod
            assert lat.simple_root(i).scalar(spc.simple_coroot(j)) ==
aprod

```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#38750
Reported by: Skip G
Reviewer(s): Skip G, Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 9, 2024
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Goal of this PR:
   * Fix Exhibit A in sagemath#15325
   * Exhibits B and C in the issue are ignored because they are not
strictly speaking errors

Status quo:
   * Some inner products for elements of root spaces or ambient spaces
give wrong answers or raise exceptions

Fix:
   * Adds a few lines of code to scalar product functions in
ambient_space and root_space
   * TESTS were added to scalar product member functions to exhibit
fixing this issue

Notes:
   * I am unable to verify that the documentation builds because I
cannot build the documentation (build problems with this version of
Sage)

A more thorough test of this functionality, which checks Exhibit A from
the issue on more cases, is provided by the following code snippet:

```
for ct in [['G', 2], ['F', 4], ['E', 8], ['E', 7]] + [[x, 6] for x in
['A', 'B', 'C', 'D', 'E']]:
    rt = RootSystem(ct)
    print(ct)
    lat = rt.root_lattice()
    spc = rt.ambient_space()
    ell = lat.rank()
    C = rt.cartan_matrix()
    for i in range(1,ell+1):
        assert lat.simple_root(i) == spc.simple_root(i)
        assert lat.simple_coroot(i) == spc.simple_coroot(i)
        for j in range(1,ell+1):
            aprod = C[j-1,i-1]
            assert lat.simple_root(i).scalar(lat.simple_coroot(j)) ==
aprod
            assert spc.simple_root(i).scalar(spc.simple_coroot(j)) ==
aprod
            assert spc.simple_root(i).scalar(lat.simple_coroot(j)) ==
aprod
            assert lat.simple_root(i).scalar(spc.simple_coroot(j)) ==
aprod

```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#38750
Reported by: Skip G
Reviewer(s): Skip G, Travis Scrimshaw
@vbraun vbraun merged commit 0ac3318 into sagemath:develop Oct 12, 2024
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants