简体   繁体   English

Sympy多维集

[英]Sympy Multi-Dimensional Set

Does there exist a concept of a multi-dimensional set? 是否存在多维集的概念?

For example, all real numbers between 0, and 10 can be defined with the set: 例如,可以使用以下集合定义介于0到10之间的所有实数:

ExampleInterval = sympy.Interval(-10, 10)

What I want a set that describes all the coordinates (x, y, z...) where x is in one interval, y is in another, z in another, ... etc ? 我想要一个描述所有坐标(x,y,z ...)的集合,其中x在一个区间中,y在另一个区间中,z在另一个区间中,等等。

I don't understand how sympy sets, are linked to variables. 我不明白如何将sympy集链接到变量。

From the Sympy Set documentation , this would be a ProductSet. Sympy Set文档中 ,这将是一个ProductSet。 You could construct one with the ProductSet constructor, or by using the * operator on Intervals: 您可以使用ProductSet构造函数或在Intervals上使用*运算符来构造一个:

from sympy import Interval, ProductSet

box = ProductSet(Interval(x1, x2), Interval(y1, y2), Interval(z1, z2))
# or
box = Interval(x1, x2) * Interval(y1, y2) * Interval(z1, z2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM