charfcn - Maple Help

charfcn

characteristic function for expressions and sets

 Calling Sequence charfcn[A](x)

Parameters

 x - any algebraic expression A - specification for a set

Description

 • The charfcn function is the characteristic function of the "set" A.  It is defined to be

$\mathrm{charfcn}\left[A\right]\left(x\right)=\left\{\begin{array}{cc}1& x\in A\\ 0& x\notin A\\ \mathrm{\text{'}charfcn}\left[A\right]\left(x\right)\text{'}& \mathrm{otherwise}\end{array}$

 • The set specification A can be a set, a real numeric, a complex numeric, a real numeric range, a complex numeric range, an arbitrary range, or an expression sequence of any of the previous.  The meaning of each one of these is as follows

 $A$ can be: "in" ($\in$) means: ----------- -------------------- a set set membership a real or complex numeric equality a real numeric range, $a..b$ $a\le x\le b$ a complex numeric range, $a..b$ $\mathrm{\Re }\left(a\right)\le \mathrm{\Re }\left(x\right)\le \mathrm{\Re }\left(b\right)$ and $\mathrm{\Im }\left(a\right)\le \mathrm{\Im }\left(x\right)\le \mathrm{\Im }\left(b\right)$ (so $a$ is the bottom left corner, $b$ is the top right corner) an arbitrary range, $a..b$ $a\le x\le b$, as determined by $\mathrm{signum}\left(0\right)$-- note that $\mathrm{\Im }\left(a\right),\mathrm{\Im }\left(b\right),\mathrm{\Im }\left(x\right)$ must all evaluate to $0$ an expression sequence of any of the above (except set) "or" of the above conditions an expression sequence of sets set membership in the union of the sets

 • When the specification is a set, the maple function member is used to test set membership, and thus charfcn will always return one of 0 or 1 in this case.  In the other cases, charfcn is symbolic, in that it will return unevaluated if the "in" conditions cannot be verified or the specification is not exactly as described above.
 • Ranges $a..b$ where $b are treated as empty, and so charfcn will return 0 for all input.

Examples

 > $\mathrm{charfcn}\left[3,5,9\right]\left(0\right)$
 ${0}$ (1)
 > $\mathrm{charfcn}\left[3,5,9\right]\left(3\right)$
 ${1}$ (2)
 > $\mathrm{charfcn}\left[3,5,9\right]\left(x\right)$
 ${{\mathrm{charfcn}}}_{{3}{,}{5}{,}{9}}{}\left({x}\right)$ (3)
 > $\mathrm{charfcn}\left[3.13..3.16\right]\left(\mathrm{\pi }\right)$
 ${1}$ (4)
 > $\mathrm{charfcn}\left[0..3,5..7\right]\left(6\right)$
 ${1}$ (5)
 > $\mathrm{charfcn}\left[\left\{\mathrm{one},\mathrm{three},\mathrm{two}\right\}\right]\left(\mathrm{four}\right)$
 ${0}$ (6)
 > $\mathrm{charfcn}\left[\left\{\mathrm{one},\mathrm{three},\mathrm{two}\right\}\right]\left(\mathrm{two}\right)$
 ${1}$ (7)
 > $\mathrm{charfcn}\left[1+I..3+2I\right]\left(2+I\right)$
 ${1}$ (8)
 > $\mathrm{charfcn}\left[3+I..3+2I,7,\mathrm{\pi }..{\mathrm{\pi }}^{2}\right]\left(\mathrm{exp}\left({y}^{3}\right)\right)$
 ${{\mathrm{charfcn}}}_{{3}{+}{I}{..}{3}{+}{2}{}{I}{,}{7}{,}{\mathrm{\pi }}{..}{{\mathrm{\pi }}}^{{2}}}{}\left({{ⅇ}}^{{{y}}^{{3}}}\right)$ (9)
 > $\mathrm{assume}\left(1.1
 > $\mathrm{charfcn}\left[3+I..3+2I,7,\mathrm{\pi }..{\mathrm{\pi }}^{2}\right]\left(\mathrm{exp}\left({y}^{3}\right)\right)$
 ${1}$ (10)
 > $\mathrm{charfcn}\left[3+I..-1+2I\right]\left(x\right)$
 ${0}$ (11)