Spaces:
Sleeping
Sleeping
File size: 2,668 Bytes
b66f126 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | .. _sets-module:
====
Sets
====
Basic Sets
----------
.. automodule:: sympy.sets.sets
.. autoclass:: Set
:members:
.. autofunction:: imageset
Elementary Sets
---------------
.. autoclass:: Interval
:members:
.. autoclass:: FiniteSet
:members:
Compound Sets
-------------
.. autoclass:: Union
:members:
.. autoclass:: Intersection
:members:
.. autoclass:: ProductSet
:members:
.. autoclass:: Complement
:members:
.. autoclass:: SymmetricDifference
:members:
.. autoclass:: DisjointUnion
:members:
Singleton Sets
--------------
.. autoclass:: EmptySet
:members:
.. autoclass:: UniversalSet
:members:
Special Sets
------------
.. automodule:: sympy.sets.fancysets
.. autoclass:: Rationals
:members:
.. autoclass:: Naturals
:members:
.. autoclass:: Naturals0
:members:
.. autoclass:: Integers
:members:
.. autoclass:: Reals
:members:
.. autoclass:: Complexes
:members:
.. autoclass:: ImageSet
:members:
.. autoclass:: Range
:members:
.. autoclass:: ComplexRegion
:members:
.. autoclass:: CartesianComplexRegion
:members:
.. autoclass:: PolarComplexRegion
:members:
.. autofunction:: normalize_theta_set
Power sets
----------
.. automodule:: sympy.sets.powerset
.. autoclass:: PowerSet
:members:
Condition Sets
--------------
.. automodule:: sympy.sets.conditionset
.. autoclass:: ConditionSet
:members:
.. autoclass:: Contains
:members:
SetKind
-------
.. autoclass:: SetKind
:members:
Iteration over sets
-------------------
For set unions, `\{a, b\} \cup \{x, y\}` can be treated as
`\{a, b, x, y\}` for iteration regardless of the distinctiveness of
the elements, however, for set intersections, assuming that
`\{a, b\} \cap \{x, y\}` is `\varnothing` or `\{a, b \}` would not
always be valid, since some of `a`, `b`, `x` or `y` may or may not be
the elements of the intersection.
Iterating over the elements of a set involving intersection, complement,
or symmetric difference yields (possibly duplicate) elements of the set
provided that all elements are known to be the elements of the set.
If any element cannot be determined to be a member of a set then the
iteration gives ``TypeError``.
This happens in the same cases where ``x in y`` would give an error.
There are some reasons to implement like this, even if it breaks the
consistency with how the python set iterator works.
We keep in mind that sympy set comprehension like ``FiniteSet(*s)`` from
a existing sympy sets could be a common usage.
And this approach would make ``FiniteSet(*s)`` to be consistent with any
symbolic set processing methods like ``FiniteSet(*simplify(s))``.
|