intersect
, _intersect
Intersection of sets or intervals or both
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
set_{1} intersect set_{2}
_intersect(set_{1}, set_{2}, …
)
intersect
computes the intersection of sets
and intervals.
set1 intersect set2
is equivalent to _intersect(set1,
set2)
.
The precedences of intersect
, minus
, union
are
as follows. If in doubt, use parentheses to ensure that the expression
is parsed as desired.
The operator intersect
is stronger
binding than minus
, that is, set1 intersect
set2 minus set3
= (set 1 intersect set2) minus
set3
.
The operator minus
is stronger
binding than union
, that is, set1 minus
set2 union set3
= (set1 minus set2) union set3
.
set1 minus set2 minus set3
= (set
1 minus set2) minus set3
If sets or intervals are specified by symbolic expressions involving
identifiers or indexed identifiers, then symbolic calls of _intersect
are
returned. On the screen, they are represented via the operator notation set1
intersect set2
.
On finite sets of type DOM_SET
, intersect
acts
in a purely syntactical way. For example, {1}
intersect {x}
simplifies to an empty set {}
.
Mathematically, this result can be incorrect in general, because x
can
represent the value 1.
On intervals of type Dom::Interval
, intersect
acts
in a semantical way. In particular, properties of identifiers are taken into
account.
_intersect()
returns universe
(of type stdlib::Universe
),
which represents the set of all mathematical objects.
intersect
operates on finite sets:
{x, 1, 5} intersect {x, 1, 3, 4}
For symbolic sets, specified as identifiers or indexed identifiers, symbolic calls are returned:
{1, 2} intersect A intersect {2, 3}
Note that intersect
acts on finite sets in
a purely syntactical way. In the following call, x
does
not match any of the numbers 1, 2, 3 syntactically:
{1, 2, 3} intersect {1, x}
intersect
is overloaded by the domain Dom::Interval
:
Dom::Interval(2, infinity) intersect Dom::Interval([1, 3])
{PI/2, 2, 2.5, 3} intersect Dom::Interval(1,3)
In contrast to finite sets of type DOM_SET
, the interval
domain works semantically. It takes properties
into account:
Dom::Interval(1, 1) intersect {x}
assume(0 < x < 1): Dom::Interval(1, 1) intersect {x}
unassume(x):
The following list provides a collection of sets:
L := [{a, b}, {1, 2, a, c}, {3, a, b}, {a, c}]:
The functional equivalent _intersect
of the intersect
operator
accepts an arbitrary number of arguments. Thus, the intersection of
all sets in L
can be computed as follows:
_intersect(op(L))
delete L:

Finite sets of type 
Set, an interval, a symbolic expression of type "_intersect"
,
or universe
.
set1
, set2