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

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

Open
2 tasks done
maxale opened this issue Dec 10, 2024 · 3 comments
Open
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
Collaborator

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

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