in - Maple Help

PolyhedralSets

 intersect
 polyhedral intersection operator
 subset
 polyhedral subset operator
 in
 polyhedral membership operator

Calling Sequence

 s1 intersect s2 $\mathrm{s1}\cap \mathrm{s2}$ intersect(s1, s2, s3, ...) s1 subset s2 $\mathrm{s1}\subseteq \mathrm{s2}$ subset(s1,s2) s1 in s2 $\mathrm{s1}\in \mathrm{s2}$ in(s1,s2) pnt in s1 $\mathrm{pnt}\in \mathrm{s1}$ in(pnt,s1)

Parameters

 s1, s2, s3, ... - polyhedral sets pnt - point specified as list of rationals, or list or set of equations of the form coordinate = rational

Description

 • The PolyhedralSets package provides definitions for the intersect, subset and in set operators.  The intersection operators returns a new polyhedral set, while the subset and in operators return either true or false.
 • The definition of the set operators can be loaded using with(PolyhedralSets).

Examples

 > $\mathrm{with}\left(\mathrm{PolyhedralSets}\right):$

Intersection

 • Four of the corners of a cube can be cut off by taking its intersection with a tetrahedron
 > $\mathrm{tetra}≔\mathrm{PolyhedralSet}\left(2\left[\left[1,1,1\right],\left[1,-1,-1\right],\left[-1,1,-1\right],\left[-1,-1,1\right]\right],\left[x,y,z\right]\right):$$\mathrm{cube}≔\mathrm{ExampleSets}:-\mathrm{Cube}\left(\left[x,y,z\right]\right):$$\mathrm{t_c_intersect}≔\mathrm{tetra}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}∩\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{cube}$
 ${\mathrm{t_c_intersect}}{≔}{{}\begin{array}{lll}{\mathrm{Coordinates}}& {:}& \left[{x}{,}{y}{,}{z}\right]\\ {\mathrm{Relations}}& {:}& \left[{-}{z}{\le }{1}{,}{z}{\le }{1}{,}{-}{y}{\le }{1}{,}{y}{\le }{1}{,}{-}{y}{-}{z}{-}{x}{\le }{2}{,}{-}{x}{\le }{1}{,}{y}{+}{z}{-}{x}{\le }{2}{,}{x}{-}{y}{+}{z}{\le }{2}{,}{x}{\le }{1}{,}{x}{+}{y}{-}{z}{\le }{2}\right]\end{array}$ (1)
 > $\mathrm{Plot}\left(\mathrm{t_c_intersect}\right)$

Subset

 • Construct a tetrahedron and a cube
 > $\mathrm{tetra}≔\mathrm{ExampleSets}:-\mathrm{Tetrahedron}\left(\right)$
 ${\mathrm{tetra}}{≔}{{}\begin{array}{lll}{\mathrm{Coordinates}}& {:}& \left[{{x}}_{{1}}{,}{{x}}_{{2}}{,}{{x}}_{{3}}\right]\\ {\mathrm{Relations}}& {:}& \left[{-}{{x}}_{{1}}{-}{{x}}_{{2}}{-}{{x}}_{{3}}{\le }{1}{,}{-}{{x}}_{{1}}{+}{{x}}_{{2}}{+}{{x}}_{{3}}{\le }{1}{,}{{x}}_{{1}}{-}{{x}}_{{2}}{+}{{x}}_{{3}}{\le }{1}{,}{{x}}_{{1}}{+}{{x}}_{{2}}{-}{{x}}_{{3}}{\le }{1}\right]\end{array}$ (2)
 > $\mathrm{cube}≔\mathrm{ExampleSets}:-\mathrm{Cube}\left(\right)$
 ${\mathrm{cube}}{≔}{{}\begin{array}{lll}{\mathrm{Coordinates}}& {:}& \left[{{x}}_{{1}}{,}{{x}}_{{2}}{,}{{x}}_{{3}}\right]\\ {\mathrm{Relations}}& {:}& \left[{-}{{x}}_{{3}}{\le }{1}{,}{{x}}_{{3}}{\le }{1}{,}{-}{{x}}_{{2}}{\le }{1}{,}{{x}}_{{2}}{\le }{1}{,}{-}{{x}}_{{1}}{\le }{1}{,}{{x}}_{{1}}{\le }{1}\right]\end{array}$ (3)
 • The tetrahedron tetra is a subset of the cube cube
 > $\mathrm{tetra}⊆\mathrm{cube}$
 ${\mathrm{true}}$ (4)
 • But cube isn't a subset of tetra
 > $\mathrm{cube}⊆\mathrm{tetra}$
 ${\mathrm{false}}$ (5)

In

 • Any point in a set will return true when tested with in
 > $c≔\mathrm{ExampleSets}:-\mathrm{Cube}\left(\right)$
 ${c}{≔}{{}\begin{array}{lll}{\mathrm{Coordinates}}& {:}& \left[{{x}}_{{1}}{,}{{x}}_{{2}}{,}{{x}}_{{3}}\right]\\ {\mathrm{Relations}}& {:}& \left[{-}{{x}}_{{3}}{\le }{1}{,}{{x}}_{{3}}{\le }{1}{,}{-}{{x}}_{{2}}{\le }{1}{,}{{x}}_{{2}}{\le }{1}{,}{-}{{x}}_{{1}}{\le }{1}{,}{{x}}_{{1}}{\le }{1}\right]\end{array}$ (6)
 > $\left[0,0,0\right]\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}∈\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}c$
 ${\mathrm{true}}$ (7)
 • To find the face on which the point resides, see PolyhedralSets[LocatePoint]

Compatibility

 • The PolyhedralSets[intersect], PolyhedralSets[subset] and PolyhedralSets[in] commands were introduced in Maple 2015.