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

Can arbitrary n-number container be introduced? #19754

Open
mcpl-sympy opened this issue Jul 12, 2020 · 6 comments
Open

Can arbitrary n-number container be introduced? #19754

mcpl-sympy opened this issue Jul 12, 2020 · 6 comments
Labels

Comments

@mcpl-sympy
Copy link
Contributor

mcpl-sympy commented Jul 12, 2020

I reckon that this may be helpful for introducing function with arbitrary number of arguments. Maybe what we need is SymPy-version generator.
Perhaps we can allow n-numbered Cartesian product of set as well? S.Reals**Symbol('n', integer=True, positive=True) currently raises error.

@oscarbenjamin
Copy link
Contributor

I think that Reals**n for a symbol n makes sense. I'm not sure what we could do with it though. I don't know how you would implement it though given that there is no set power object. Currently Reals ** 3 is just ProductSet(Reals, Reals, Reals).

Generally a product set represents a set of Tuples so I guess when you say "n-number container" you mean a symbolic object that somehow represents a Tuple of length n where n is given as a symbol/expression. That would probably need to be a purely symbolic stand in though like MatrixSymbol.

@sylee957
Copy link
Member

sylee957 commented Jul 12, 2020

I think that a cartesian power class should be introduced also to remove the need to copy S.Reals n times.
But I can't think of the name that can align with ProductSet

@oscarbenjamin
Copy link
Contributor

Another possibility is that the CartesianProduct class could gain an exponent for each base set. That would make it possible to define something like the set of n+1 tuples of n reals and one integer as ProductSet((Reals, n), (Integers, 1)). That's not the same as ProductSet(Reals**n, Integers) which would be a set of 2-tuples where the first element is a tuple of n reals.

@asmeurer
Copy link
Member

You'd need a way to represent the elements of such a set first.

There's also A**B which is the set of functions from B to A. A**n is isomorphic to A**{1, 2, ..., n}, though I think it's worth keeping those distinct for the purposes of the type system.

@Smit-create
Copy link
Member

Similar issue #17267

@sylee957
Copy link
Member

Is the cartesian product A**B able to represent variadic functions?
I think that the only thing needed is a way to represent variadic functions, which is used often in python like *args as how people define functions, but which lacks mathematical machinery.

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

5 participants