Skip to content

Argument regular= makes Partitions(...) silently ignore other arguments #39107

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

Closed
2 tasks done
maxale opened this issue Dec 10, 2024 · 3 comments
Closed
2 tasks done

Argument regular= makes Partitions(...) silently ignore other arguments #39107

maxale opened this issue Dec 10, 2024 · 3 comments
Labels

Comments

@maxale
Copy link
Contributor

maxale commented Dec 10, 2024

Steps To Reproduce

Consider the code:

sage: Partitions(24,length=8,max_part=5).cardinality()
33
sage: Partitions(24,length=8,max_part=5,regular=5).cardinality()
950
sage: Partitions(24,regular=5).cardinality()
950

Expected Behavior

When in addition to length=8,max_part=5 we specify regular=5 we expect to see the cardinality at most 33, but we get a larger cardinality of 950.

Actual Behavior

Partitions(24,length=8,max_part=5,regular=5) seems to ignore length=8,max_part=5 and to produce the same result as Partitions(24,regular=5).

Additional Information

No response

Environment

  • OS: Ubuntu 24.04.1 LTS
  • Sage Version: 10.5.beta9

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@maxale maxale added the t: bug label Dec 10, 2024
@mantepse
Copy link
Contributor

mantepse commented Dec 10, 2024

Did you check whether this is fixed with the pr concerning #38897 ?

Indeed, with #38904 I get

sage: Partitions(24,length=8,max_part=5,regular=5).cardinality()
...
ValueError: the parameters 'parts_in', 'starting', 'ending', 'regular' and 'restricted' cannot be combined with anything else

@maxale
Copy link
Contributor Author

maxale commented Dec 10, 2024

@mantepse: That's better and somewhat fixes the issue in the original code example. However, the new ValueError is inconsistent with the documentation for regular=, which says:

regular=ell specifies that the partitions are $\ell$-regular, and can only be combined with the max_length or max_part, but not both, keywords if $n$ is not specified

Note that it always allows combining regular= with one of max_length or max_part, and even with both when argument n is given.

Hence, from reading this I'd expect the following modified example work Partitions(24,max_length=8,max_part=5,regular=5).cardinality() and its result not exceed that without regular=5.

@maxale
Copy link
Contributor Author

maxale commented Dec 11, 2024

Or am I misreading the docs? The other potential meaning may be as follows:

regular=ℓ specifies that the partitions are ℓ-regular; it cannot be combined with any other keywords unless n is not specified, in which case it can be combined with one, but not both, of the max_length or max_part keywords.

If that's the intended meaning, then the docs wording needs to be improved (eg. like I suggest above).

PS. And even here the "both keywords" case is not actually forbidden to the docs contrary:

sage: Partitions(max_length=8,max_part=8,regular=5)
Partitions satisfying constraints max_length=8, max_part=8, regular=5

vbraun pushed a commit to vbraun/sage that referenced this issue Jan 9, 2025
sagemathgh-38904: provide a class for partitions with bounded length and minimal part
    
We provide a new class, `PartitionsSmallestGE` to handle subsets of the
constraints `length`, `min_length`, `max_length` and `min_part`, to make
cardinality computations with such constraints reasonable.

Fixes sagemath#38897, sagemath#39107
    
URL: sagemath#38904
Reported by: Martin Rubey
Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this issue Jan 10, 2025
sagemathgh-38904: provide a class for partitions with bounded length and minimal part
    
We provide a new class, `PartitionsSmallestGE` to handle subsets of the
constraints `length`, `min_length`, `max_length` and `min_part`, to make
cardinality computations with such constraints reasonable.

Fixes sagemath#38897, sagemath#39107
    
URL: sagemath#38904
Reported by: Martin Rubey
Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this issue Jan 12, 2025
sagemathgh-38904: provide a class for partitions with bounded length and minimal part
    
We provide a new class, `PartitionsSmallestGE` to handle subsets of the
constraints `length`, `min_length`, `max_length` and `min_part`, to make
cardinality computations with such constraints reasonable.

Fixes sagemath#38897, sagemath#39107
    
URL: sagemath#38904
Reported by: Martin Rubey
Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this issue Jan 16, 2025
sagemathgh-38904: provide a class for partitions with bounded length and minimal part
    
We provide a new class, `PartitionsSmallestGE` to handle subsets of the
constraints `length`, `min_length`, `max_length` and `min_part`, to make
cardinality computations with such constraints reasonable.

Fixes sagemath#38897, sagemath#39107
    
URL: sagemath#38904
Reported by: Martin Rubey
Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this issue Jan 17, 2025
sagemathgh-38904: provide a class for partitions with bounded length and minimal part
    
We provide a new class, `PartitionsSmallestGE` to handle subsets of the
constraints `length`, `min_length`, `max_length` and `min_part`, to make
cardinality computations with such constraints reasonable.

Fixes sagemath#38897, sagemath#39107
    
URL: sagemath#38904
Reported by: Martin Rubey
Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
@maxale maxale closed this as completed May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy