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

FiniteSet documentation inconsistent with usage in sympy #23585

Closed
eendebakpt opened this issue Jun 6, 2022 · 3 comments · Fixed by #23594
Closed

FiniteSet documentation inconsistent with usage in sympy #23585

eendebakpt opened this issue Jun 6, 2022 · 3 comments · Fixed by #23594
Labels

Comments

@eendebakpt
Copy link
Contributor

The documentation for FiniteSet (https://github.com/sympy/sympy/blob/master/sympy/sets/sets.py#L1886) states that the FiniteSet: Represents a finite set of discrete numbers..

But in sympy itself the FiniteSet is used with non-integer arguments. Statements like FiniteSet('a', 'd', 'c') run fine.

@ritikBhandari
Copy link
Contributor

Yes if that's the case it should be something like Represents a finite set of discrete elements of a particular type ig?

@oscarbenjamin
Copy link
Contributor

There isn't really any "particular type". A FiniteSet is just a finite set of SymPy expressions. The set is uniquified through Eq bit the elements don't need to have any common type.

@asmeurer
Copy link
Member

asmeurer commented Jun 6, 2022

FiniteSet('a', 'd', 'c') actually creates a set of symbols because it is using string parsing. To create a set of strings you would need to have a symbolic expression type representing a string (we do have a Str class but I think it's only meant for internal use).

You're right though that set objects shouldn't be restricted to holding just numbers, or even just Expr, although perhaps it would be useful to make sets restricted a single kind of object at a time by default so that you can use FiniteSet.kind.

skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 7, 2022
skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 7, 2022
skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants