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
|
<HTML>
<HEAD>
<TITLE>BOOLEAN</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF" fgcolor="#000000">
<P><A NAME="boolean"></A>
<font size="+3" color="green"><B>BOOLEAN</B></font></P>
<p><table>
<tr>
<td><CODE><font color="blue">|</font></CODE></td><td>or</td>
<td><CODE><font color="blue">||</font></CODE></td><td>exclusive or</td></tr>
<tr>
<td><CODE><font color="blue">&</font></CODE></td><td>and</td>
<td><CODE><font color="blue">~</font></CODE></td><td>not</td></tr>
<tr>
<td><CODE><font color="blue">=</font></CODE></td><td>equal to</td>
<td><CODE><font color="blue">~=</font></CODE></td><td>not equal to</td></tr>
<tr>
<td><CODE><font color="blue">></font></CODE></td><td>greater than</td>
<td><CODE><font color="blue"><</font></CODE></td><td>less than</td></tr>
<tr>
<td><CODE><font color="blue">>=</font></CODE></td><td>greater than or equal to </td>
<td><CODE><font color="blue"><=</font></CODE></td><td>less than or equal to</td></tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4" align=center><b>Boolean operators</b></td></tr>
</table></p>
<P>
The Boolean operators return a value of <CODE>0</CODE> when false and
<CODE>1</CODE> when true.</p>
<p>
The Boolean operators can operate on scalars, vectors, matrices, or tensors, but
both operands must be the same size and shape. The result of the operation
is a variable with this size and shape.</p>
<p>
All of the Boolean operators are binary, except for the not operator,
<CODE>~</CODE>, which is unary.</P>
<p><font size="+1" color="green">Examples</font></p>
<p>
Suppose you have two vectors: <CODE>X = [1;2;3;4;5;6;7]</CODE> and
<CODE>Y = [-2;-1;0;1;2;3;4]</CODE>. Then,</p>
<p>
<font color="blue"><pre>
X|Y = [1;1;1;1;1;1;1]
X||Y = [0;0;1;0;0;0;0]
X&Y = [1;1;0;1;1;1;1]
X=Y = [0;0;0;0;0;0;0]
X~=Y = [1;1;1;1;1;1;1]
X>Y = [1;1;1;1;1;1;1]
X<Y = [0;0;0;0;0;0;0]
X>=Y = [1;1;1;1;1;1;1]
X<=Y = [0;0;0;0;0;0;0]
~(X|Y) = [0;0;0;0;0;0;0]
</pre></font></P>
</BODY>
</HTML>
|