You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we have a collection of sets, for example `{ { 1,2,3 }, { 3,4,5 } , { 3, 5, 6, 7 } }`, often called a *family* of sets
259
+
in Set Theory, we can take the union and intersection of the family. That is, `( { 1, 2, 3 } union { 3, 4, 5 } ) union { 3, 5, 6, 7 }` and likewise for intersection. In Set Theory a large union and intersection symbol is used for this purpose.
260
+
261
+
Note that, at present, these operations are implemented
262
+
naively by iteratively calling the `union` and `intersect`
263
+
methods above. More efficient implementations are possible
264
+
and welcome.
265
+
266
+
#### Union of a Family of Sets
267
+
268
+
At present the family of sets needs to be in an array of `Set`s.
269
+
Then we pass that array of sets to `Set::UnionOfArray()`.
270
+
For example:
271
+
```php
272
+
$set1 = Set(1,2,3);
273
+
$set2 = Set(3,4,5);
274
+
$set_family = [ $set1, $set2 ];
275
+
$set_union = Set::UnionOfArray($set_family);
276
+
```
277
+
278
+
#### Intersection of a Family of Sets
279
+
280
+
As with `UnionOfArray`, the family of sets needs to be in an array of `Set`s.
281
+
Then pass that array of sets to `Set::IntersectionOfArray()`.
0 commit comments