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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
|
<HTML>
<HEAD>
<TITLE>A+ Reference: Dyadic Scalar Functions</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<A NAME=HEADING110>
<H1><FONT color="#FF0000">Dyadic <A NAME=0>Scalar Functions</FONT></H1>
<a name="CONTENTS6">
<UL>
<A HREF="#HEADING111"> Classification of Dyadic Scalar Functions</A><BR>
<A HREF="#HEADING112"> Application, Conformability, and Result Shape</A><BR>
<A HREF="#HEADING113"> Common Error Reports</A><BR>
<A HREF="#HEADING113A"> Function Definitions</A><BR>
<UL>
<A HREF="#HEADING114"> Add</A><font face=Kapl> y+x</font><BR>
<A HREF="#HEADING115"> And</A><font face=Kapl> y^x</font><BR>
<A HREF="#HEADING116"> Circle</A><font face=Kapl> yx</font><BR>
<UL>
<A HREF="#HEADING117">Table: Notation for the Circle Functions</A><BR>
</UL>
<A HREF="#HEADING118"> Combine Symbols</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING119"> Divide</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING120"> Equal to</A><font face=Kapl> y=x</font><BR>
<A HREF="#HEADING121"> Greater than</A><font face=Kapl> y>x</font><BR>
<A HREF="#HEADING122"> Greater than or Equal to</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING123"> Less than</A><font face=Kapl> y<x</font></A><BR>
<A HREF="#HEADING124"> Less than or Equal to</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING125"> Log</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING126"> Max</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING127"> Min</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING128"> Multiply</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING129"> Not equal to</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING130"> Or</A><font face=Kapl> yx</font><BR>
<A HREF="#HEADING131"> Power</A><font face=Kapl> y*x</font><BR>
<A HREF="#HEADING132"> Residue</A><font face=Kapl> y|x</font><BR>
<A HREF="#HEADING133"> Subtract</A><font face=Kapl> y-x</font><BR>
</UL>
</UL>
<HR>
<blockquote>
As stated in the introduction, the term <i>integer</i> is used in this manual to indicate not only a domain of values but also a particular internal representation. To refer to the same domain of values when both integer and floating-point representations are allowed, the term <i>restricted whole number</i> is used. These floating-point representations need only be tolerably equal to the integers.
</blockquote>
<A NAME=HEADING111>
<H1><FONT color="#20B2AA">Classification <A NAME=1>of Dyadic Scalar Functions</FONT></H1>
<blockquote>
Although they are listed alphabetically in this chapter, for convenient reference, the A+ dyadic scalar primitive functions can be grouped in five categories:<P>
<UL>
<LI>the most common arithmetical functions: Add, Subtract, Multiply, Divide, Power;
<LI>other computational functions: Residue, Log, Circle, Combine Symbols;
<LI>selection functions: Max (greater of), Min (lesser of);
<LI>comparison functions: Equal to, Not equal to, Less than, Less than or Equal to, Greater than, Greater than or Equal to;
<LI>logical functions: And, Or.
</UL>
</blockquote>
<A NAME=HEADING112>
<H1><FONT color="#20B2AA">Application, <A NAME=7>Conformability, and Result Shape</FONT></H1>
<blockquote>
<! ------------------------------------------------------------------------>
All dyadic scalar functions produce scalars from scalars,
and apply element by element to their arguments: they are applied to each pair of elements - one from each argument - independently of the others. There are three conformable cases for dyadic scalar functions: <P>
<ol>
<! ------------------------------------------------------------------------>
<li>The arguments have identical shapes. In this case, corresponding elements from the two arguments are paired. The shape of the result equals the common shape of the arguments.<P>
<img src="EbyE1c.gif" width="300"><p>
<! ------------------------------------------------------------------------>
<A NAME=8><li>One argument has exactly one element and the other does not. Then the single
element (a "singleton") from the one argument is paired independently with each element of the other. The
shape of the result equals the shape of the one with either more or fewer than one element.
This case is called <i>scalar extension</i>.<P>
<img src="EbyE2c.gif" width="300"><p>
then:<br>
<img src="EbyE3c.gif" width="300"><p>
<! ------------------------------------------------------------------------>
<li>Each argument has one element. Then the result has a single element also. The rank of the result equals the larger of the two argument ranks.<P>
<pre><font face=Kapl>
2+,2 Shapes are conformable
4
2+2 Scalar plus scalar
</font>(empty)<font face=Kapl>
2+,2 Scalar plus one-element vector
1
</font>
</pre>
</ol>
<! ------------------------------------------------------------------------>
The element-by-element application of the functions and the above conformability rules for their arguments are assumed in the following descriptions.
</blockquote>
<A NAME=HEADING113>
<H1><FONT color="#20B2AA">Common <A NAME=11>Error Reports</FONT></H1>
<blockquote>
Multiple errors elicit but one report. Eight reports, including interrupt, are common to all dyadic primitive scalar functions, and each of these reports is issued only if none of the preceding ones apply:<P>
<UL>
<LI>parse: this error class includes valence errors that result from three or more arguments in braces;
<LI>value: an argument has no value;
<LI>nondata: an argument is a function or some other nondata object;
<LI>type: an argument is of an illicit type;
<LI>rank: conformability rules are not satisfied and the ranks of the arguments differ;
<LI>length: conformability rules are not satisfied because of a mismatch in a dimension of the arguments;
<LI>wsfull: the workspace is currently not large enough for execution of the function; a bare left arrow (<font face=Kapl></font>), which dictates resumption of execution, causes the workspace to be enlarged if possible;
<LI>interrupt (not an error): the user pressed <b>c</b> twice (once if A+ was started from a
shell) while holding the <b>Control</b> key down.
</UL>
Except where noted, the omission of the left argument results not in a valence error report, but in the invocation of a monadic function or an operator that shares the function symbol.
</blockquote>
<A NAME=HEADING113A>
<H1><FONT color="#20B2AA">Function Definitions</FONT></H1>
<A NAME=HEADING114>
<H2><FONT color="#20B2AA">Add<A NAME=16><font face=Kapl> y+x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. For two nonempty arguments, the result is integer if both arguments are integer and all result elements lie inside the range of integer representation, and floating point otherwise. If exactly one argument is empty, the result is floating point if that argument is floating point, and otherwise its type is the type of the nonempty argument. If both are empty, then if one is floating point and the other integer the result is floating point, and otherwise its type is the type of the right argument.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
<font face=Kapl>y</font> plus <font face=Kapl>x</font>. The result may include <font face=Kapl>Inf</font> or <font face=Kapl>Inf</font>.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 1 0 1 1e308+10 20 30 1e308
9 20 31 Inf</font></pre>
</BLOCKQUOTE><A NAME=HEADING115>
<H2><FONT color="#20B2AA">And<A NAME=20><font face=Kapl> y^x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments are simple arrays of restricted whole numbers. The result is an integer array.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
If <font face=Kapl>x</font> and <font face=Kapl>y</font> have boolean values (0 and 1) then <font face=Kapl>y^x</font> is the Logical And of <font face=Kapl>y</font> and <font face=Kapl>x</font>. That is:<P>
<ul>
<li>
<font face=Kapl>1^1</font> equals <font face=Kapl>1</font>
<li>
Any other boolean combination (<font face=Kapl>1^0</font> or <font face=Kapl>0^1</font> or <font face=Kapl>0^0</font>) equals <font face=Kapl>0</font>
</ol>
<P>
And is strictly boolean, never bitwise. All nonzero restricted whole
numbers are treated as if they were 1.<P>
To get bitwise behavior, use the
<a href="APlusRefV2_10.html#8">Bitwise</a> operator.
<p>
</BLOCKQUOTE><b> Additional Error Report Condition</b><BLOCKQUOTE>
If none of the common error conditions are reported (including an illicit, i.e., not simple numeric, type) then:<P>
<UL>
<LI>a type error is reported if an argument is not a restricted whole number.
</UL>
</BLOCKQUOTE><b> Examples</b>
<pre></font><font face=Kapl> 0 0 1 1^0 1 0 1
0 0 0 1
43^14
1</font></pre>
<A NAME=HEADING116>
<H2><FONT color="#20B2AA">Circle<A NAME=24><font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays.
Additionally, the left argument can also be symbolic.
The result is always in floating point.
<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
Strictly, the elements of a numeric left argument <font face=Kapl>y</font> must be restricted whole numbers from -7 to 7; however, all floating-point numbers greater than -8 and less than 8 are accepted and, in effect, rounded toward zero to produce integers. Each element of <font face=Kapl>y</font> indicates the trigonometric, hyperbolic, or algebraic function to be applied to the corresponding element of the right argument <font face=Kapl>x</font>. All angles are in radians. See the <A HREF="#25">table</A> for details.
<p>
<A NAME=HEADING117>
<table border=1 cellspacing=0 cellpadding=8>
<caption><FONT color="#20B2AA" size=+2><B>Notation <A NAME=25>for the Circle
Functions</B></FONT></caption>
<tr>
<th>A+ Expression</th><th>Meaning</th><th> </th><th>A+
Expression</th><th>Meaning</th></tr>
<tr>
<td><font face=Kapl>`sinarccos</font> <font face=Kapl>x </font>or<font face=Kapl> 0x</font></td><td><font face=Kapl>(1-x*2)*0.5</font></td>
<td rowspan=8> </td>
<td><br></td><td><br></td></tr>
<tr>
<td><A NAME=26><font face=Kapl>`sin</font> <font face=Kapl>x </font>or<font face=Kapl> 1x</font></td><td>sin x</td>
<td><A NAME=27><font face=Kapl>`arcsin</font> <font face=Kapl>x </font>or<font face=Kapl> 1x</font></td><td>arcsin x</td></tr>
<tr>
<td><A NAME=28><font face=Kapl>`cos</font> <font face=Kapl>x </font>or<font face=Kapl> 2x</font></td><td>cos x</td>
<td><A NAME=29><font face=Kapl>`arccos</font> <font face=Kapl>x </font>or<font face=Kapl> 2x</font></td><td>arccos x</td></tr>
<tr>
<td><A NAME=30><font face=Kapl>`tan</font> <font face=Kapl>x </font>or<font face=Kapl> 3x</font></td><td>tan x</td>
<td><A NAME=31><font face=Kapl>`arctan</font> <font face=Kapl>x </font>or<font face=Kapl> 3x</font></td><td>arctan x</td></tr>
<tr>
<td><font face=Kapl>`secarctan</font> <font face=Kapl>x </font>or<font face=Kapl> 4x</font></td><td><font face=Kapl>(1+x*2)*0.5</font></td>
<td><font face=Kapl>`tanarcsec</font> <font face=Kapl>x </font>or<font face=Kapl> 4x</font></td><td><font face=Kapl>(1+x*2)*0.5</font></td></tr>
<tr>
<td><A NAME=32><font face=Kapl>`sinh</font> <font face=Kapl>x </font>or<font face=Kapl> 5x</font></td><td>sinh x</td>
<td><A NAME=33><font face=Kapl>`arcsinh</font> <font face=Kapl>x </font>or<font face=Kapl> 5x</font></td><td>arcsinh x</td></tr>
<tr>
<td><A NAME=34><font face=Kapl>`cosh</font> <font face=Kapl>x </font>or<font face=Kapl> 6x</font></td><td>cosh x</td>
<td><A NAME=35><font face=Kapl>`arccosh</font> <font face=Kapl>x </font>or<font face=Kapl> 6x</font></td><td>arccosh x</td></tr>
<tr>
<td><A NAME=36><font face=Kapl>`tanh</font> <font face=Kapl>x </font>or<font face=Kapl> 7x</font></td><td>tanh x</td>
<td><A NAME=37><font face=Kapl>`arctanh</font> <font face=Kapl>x </font>or<font face=Kapl> 7x</font></td><td>arctanh x</td></tr>
</table><P>
When both arguments are scalar,
using the symbolic form adds about 40% to the processing time;
the symbolic form adds less, of course, when the right argument is non-scalar.
Symbolic form is heartily encouraged for all but the most time-critical applications.
<p>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If none of the common errors listed above are reported, then:<P>
<UL>
<LI>a domain error is reported if the absolute value of an element of the left argument is equal to or greater than 8, and also if the absolute value of the right argument is less than 1 for left argument -4 or greater than 1 for left arguments of 0, -1, -2, and -7.
</UL>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre></font><font face=Kapl> 1 1 3 3 2 4 2 0 </font>sin(pi/2), sin(pi/4), tan(pi/2), arctan(<font face=Kapl>Inf</font>)<font face=Kapl>
1 0.7071067812 1.633177873e+16 1.570796327</font></pre>
</BLOCKQUOTE><A NAME=HEADING118>
<H2><FONT color="#20B2AA">Combine<A NAME=43> Symbols<font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple arrays of symbols.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
This function takes context names and unqualified names and produces qualified names. More generally, for each scalar pair <font face=Kapl>y</font>,<font face=Kapl>x</font>: if, as displayed, <font face=Kapl>x</font> has a dot (period) in it, then the value of <font face=Kapl>yx</font> is <font face=Kapl>x</font>, and <font face=Kapl>y</font> is ignored; otherwise, the result is the symbol that is displayed as <font face=Kapl>y</font>, followed by a dot, followed by <font face=Kapl>x</font> without its backquote.<P>
</BLOCKQUOTE><b> Examples</b><BLOCKQUOTE>
<pre><font face=Kapl> `c `x `d.y `.z
`c.x `d.y `.z
`b.c `a `x `y
`b.c.x `a.y</font></pre>
</BLOCKQUOTE><A NAME=HEADING119>
<H2><FONT color="#20B2AA">Divide<font face=Kapl><A NAME=48> yx</FONT></H2>
</font><b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. The result is always floating point.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
<font face=Kapl>y</font> divided by <font face=Kapl>x</font>. Division of a positive number by zero yields <font face=Kapl>Inf</font>, a unique scalar, and division of a negative number by zero yields <font face=Kapl>Inf</font>.<P>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If none of the errors listed in "<A HREF="#11">Common Error Reports</A>" are reported, then:<P>
<UL>
<LI>a domain error is reported for <font face=Kapl>00</font>.
</UL>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 0 1 2 3 4 52 2 2 2 0 0
0 0.5 1 1.5 Inf Inf</font></pre>
</BLOCKQUOTE><A NAME=HEADING120>
<H2><FONT color="#20B2AA">Equal to<font face=Kapl><A NAME=51> y=x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments can be of any type.
The result is boolean (integer type with values 0 and 1).
<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The value is 1 if <font face=Kapl>y</font> tolerably equals <font face=Kapl>x</font>, and 0 if not. <P>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If there is no parse or value error (see "<A HREF="#11">Common Error Reports</A>"), then:<P>
<UL>
<LI>a valence error is reported if the left argument is missing.
</UL>
</BLOCKQUOTE><b> Examples</b><BLOCKQUOTE>
<pre></font><font face=Kapl> ' '='this is it'
0 0 0 0 1 0 0 1 0 0
(<2 3, 4+1e-13)=(2 3 4;'abcde';5 6)
1 0 0
1 2 3 = '123'
0 0 0</font></pre>
</BLOCKQUOTE><A NAME=HEADING121>
<H2><FONT color="#20B2AA">Greater <A NAME=55>than<font face=Kapl> y>x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments are simple numeric, character, or symbol arrays.
The result is boolean (integer type with values 0 and 1).
<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The value is 1 if <font face=Kapl>y</font> is greater than <font face=Kapl>x</font> and not tolerably equal to <font face=Kapl>x</font>, and 0 otherwise.
Characters are compared using their ASCII codes
and symbols using the usual lexical ordering based on the ASCII codes of their
component letters.
<P>
</BLOCKQUOTE><b> Examples</b><BLOCKQUOTE>
<pre><font face=Kapl> (200 0 90 100 101 200,(100+1e-12),100+1e-11)>100
0 0 0 0 1 1 0 1
'b' > 'abc'
1 0 0
'B' > 'abc' </font>ASCII, not English, order.<font face=Kapl>
0 0 0
`b > `a`b`c
1 0 0
`B > `a`b`c </font>Likewise.<font face=Kapl>
0 0 0
`pint > `cup `pints `pound `quart `snootful `gallon
1 0 0 0 0 1</font></pre>
</BLOCKQUOTE><A NAME=HEADING122>
<H2><FONT color="#20B2AA">Greater <A NAME=58>than or Equal to<font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments are simple numeric, character, or symbol arrays.
The result is boolean (integer type with values 0 and 1).
<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The value is 1 if <font face=Kapl>y</font> is greater than <font face=Kapl>x</font> or tolerably equal to <font face=Kapl>x</font>, and 0 otherwise.
Characters are compared using their ASCII codes
and symbols using the usual lexical ordering based on the ASCII codes of their
component letters.
<P>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If there is no parse or value error (see "<A HREF="#11">Common Error Reports</A>"), then:<P>
<UL>
<LI>a valence error is reported if the left argument is missing.
</UL>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 200 0 90 100 101 200100
0 0 0 1 1 1</font></pre>
</BLOCKQUOTE><A NAME=HEADING123>
<H2><FONT color="#20B2AA">Less than<A NAME=62><font face=Kapl> y<x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments are simple numeric, character, or symbol arrays.
The result is boolean (integer type with values 0 and 1).
<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The value is 1 if <font face=Kapl>y</font> is less than <font face=Kapl>x</font> and not tolerably equal to <font face=Kapl>x</font>, and 0 otherwise.
Characters are compared using their ASCII codes
and symbols using the usual lexical ordering based on the ASCII codes of their
component letters.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 200 0 90 100 101 200<100
1 1 1 0 0 0</font></pre>
</BLOCKQUOTE><A NAME=HEADING124>
<H2><FONT color="#20B2AA">Less <A NAME=65>than or Equal to<font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments are simple numeric, character, or symbol arrays.
The result is boolean (integer type with values 0 and 1).
<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The value is 1 if <font face=Kapl>y</font> is less than <font face=Kapl>x</font> or tolerably equal to <font face=Kapl>x</font>, and 0 otherwise.
Characters are compared using their ASCII codes
and symbols using the usual lexical ordering based on the ASCII codes of their
component letters.
<P>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If there is no parse or value error (see "<A HREF="#11">Common Error Reports</A>"), then:<P>
<UL>
<LI>a valence error is reported if the left argument is missing.
</UL>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 200 0 90 100 101 200100
1 1 1 1 0 0</font></pre>
</BLOCKQUOTE><A NAME=HEADING125>
<H2><FONT color="#20B2AA">Log<A NAME=69><font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. The result is always in floating point.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The logarithm of <font face=Kapl>x</font> to the base <font face=Kapl>y</font>.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 10.1 1 10 100 1000 1234.5 0
1 0 1 2 3 3.091491094 Inf</font></pre>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If none of the reports cited in "<A HREF="#11">Common Error Reports</A>" is issued, then:<P>
<UL>
<LI>a domain error is reported if an element of either argument is negative or if corresponding elements of the two arguments are both 1.
</UL>
</BLOCKQUOTE><A NAME=HEADING126>
<H2><FONT color="#20B2AA">Max<A NAME=74><font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. For two nonempty arguments, the result is integer if both arguments are integer, and floating point otherwise. If exactly one argument is empty, the result is floating point if that argument is floating point, and otherwise its type is the type of the nonempty argument. If both are empty, then if one is floating point and the other integer the result is floating point, and otherwise its type is the type of the right argument.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The greater of <font face=Kapl>y</font> and <font face=Kapl>x</font>. When this function is used in Reduction (<font face=Kapl>/</font>), the name Max is appropriate.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 0 3 .5 1 5 .1
3 .5 0 5 0</font></pre>
</BLOCKQUOTE><A NAME=HEADING127>
<H2><FONT color="#20B2AA">Min<A NAME=79><font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. For two nonempty arguments, the result is integer if both arguments are integer, and floating point otherwise. If exactly one argument is empty, the result is floating point if that argument is floating point, and otherwise its type is the type of the nonempty argument. If both are empty, then if one is floating point and the other integer the result is floating point, and otherwise its type is the type of the right argument.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The lesser of <font face=Kapl>y</font> and <font face=Kapl>x</font>. When this function is used in Reduction (<font face=Kapl>/</font>), the name Min is appropriate.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 99.5 100 91.1 112 99 100
99.5 100 91.1 100 99</font></pre>
</BLOCKQUOTE><A NAME=HEADING128>
<H2><FONT color="#20B2AA">Multiply<A NAME=84><font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. For two nonempty arguments, the result is integer if both arguments are integer and all result elements lie inside the range of integer representation, and floating point otherwise. If exactly one argument is empty, the result is floating point if that argument is floating point, and otherwise its type is the type of the nonempty argument. If both are empty, then if one is floating point and the other integer the result is floating point, and otherwise its type is the type of the right argument.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
<font face=Kapl>y</font> times <font face=Kapl>x</font>.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 100 1 2 3 1e308
0 10 20 30 Inf</font></pre>
</BLOCKQUOTE><A NAME=HEADING129>
<H2><FONT color="#20B2AA">Not <A NAME=88>equal to<font face=Kapl> yx</FONT></H2>
</font><b> Arguments and Result</b><BLOCKQUOTE>
The arguments can be of any type.
The result is boolean (integer type with values 0 and 1).
<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
The value is 1 if <font face=Kapl>y</font> is not tolerably equal to <font face=Kapl>x</font>, and 0 if it is. <P>
</BLOCKQUOTE><b> Additional Error Report</b><BLOCKQUOTE>
If there is no parse or value error (see "<A HREF="#11">Common Error Reports</A>"), then:<P>
<UL>
<LI>a valence error is reported if the left argument is missing.
</UL>
</BLOCKQUOTE><b> Examples</b><BLOCKQUOTE>
<pre></font><font face=Kapl> ' ''this is it'
1 1 1 1 0 1 1 0 1 1
(<2 3, 4+1e-13)(2 3 4;'abcde';5 6)
0 1 1
1 2 3 '123'
1 1 1</font></pre>
</BLOCKQUOTE><A NAME=HEADING130>
<H2><FONT color="#20B2AA">Or<A NAME=93><font face=Kapl> yx</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments are simple numeric arrays of restricted whole numbers. The result is an integer array.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
If <font face=Kapl>x</font> and <font face=Kapl>y</font> have boolean values (0 or 1) then <font face=Kapl>yx</font> is the Logical Or of <font face=Kapl>x</font> and <font face=Kapl>y</font>. That is:<BR><BR><font face=Kapl>11</font> equals <font face=Kapl>10</font> equals <font face=Kapl>01</font> equals <font face=Kapl>1</font>;<BR><font face=Kapl>00</font> equals <font face=Kapl>0</font>.
<P>
Or is strictly boolean, never bitwise.
All nonzero restricted whole numbers are treated as if they were 1.
<P>
To get bitwise behavior, use the
<a href="APlusRefV2_10.html#8">Bitwise</a> operator.
<P>
</BLOCKQUOTE><b> Additional Error Reports</b><BLOCKQUOTE>
If none of the common error conditions is reported, then, with a domain report preempting a type report:<P>
<UL>
<LI>a domain error is reported (by Cast, actually) if the left argument is Null;
<LI>a type error is reported if an argument is not a restricted whole number, unless the arguments are suitable for Cast.
</UL>
</BLOCKQUOTE><b> Examples</b>
<pre></font><font face=Kapl> 0 0 1 10 1 0 1
0 1 1 1
4314
1</font></pre>
<A NAME=HEADING131>
<H2><FONT color="#20B2AA">Power<A NAME=97><font face=Kapl> y*x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. The result is always floating point.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
<font face=Kapl>y</font> to the power <font face=Kapl>x</font>.
<font face=Kapl>10*2</font> is exactly equal to <font face=Kapl>1e2</font> but in general
there is a very slight (tolerable) difference between <font face=Kapl>10*</font><i>N</i>
and <font face=Kapl>1e</font><i>N</i>, because logarithms are used except in this special
case, whereas <font face=Kapl>1e</font><i>N</i> is exact.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><font face=Kapl> 2*0 .5 1 2 3 4 5 6 7 8 1025
1 1.414213562 2 4 8 16 32 64 128 256 Inf</font></pre>
</BLOCKQUOTE><A NAME=HEADING132>
<H2><FONT color="#20B2AA">Residue<A NAME=103><font face=Kapl> y|x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. For two nonempty arguments, the result is integer if both arguments are integer, and floating point otherwise. If exactly one argument is empty, the result is floating point if that argument is floating point, and otherwise its type is the type of the nonempty argument. If both are empty, then if one is floating point and the other integer the result is floating point, and otherwise its type is the type of the right argument.<P>
</BLOCKQUOTE><b> Dependency</b><BLOCKQUOTE>
Comparison tolerance, if an argument is in floating point (see "<A HREF="APlusRefV2_9.html#3">Comparison Tolerance</A>").<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
<font face=Kapl>y|x </font>is the remainder when<font face=Kapl> x </font>is divided by<font face=Kapl> y</font>.<font face=Kapl> 0|x
</font>equals<font face=Kapl> x</font>. If<font face=Kapl> y </font>is nonzero, then<font face=Kapl> y|x </font>is<font face=Kapl> x-yxy</font>,
in accordance with the mathematical definition of modular arithmetic, except as follows.
If<font face=Kapl> x </font>is tolerably equal to<font face=Kapl> ny</font>, where<font face=Kapl> n </font>is a whole number not
necessarily representable by type<font face=Kapl> `int</font>, then the result is 0. (So<font face=Kapl> Inf|x
</font>and<font face=Kapl> Inf|x </font>are always 0.)<P>
</BLOCKQUOTE><b> Examples</b><BLOCKQUOTE>
<pre><font face=Kapl> 100 | 1930 1941 1952 1978, 100+1e-12
30 41 52 78 0
1.4 1.4 1.4 1.4 | 3.7 3.7 3.7 3.7
0.9 0.5 0.5 0.9</font></pre>
</BLOCKQUOTE><A NAME=HEADING133>
<H2><FONT color="#20B2AA">Subtract<A NAME=108><font face=Kapl> y-x</font></FONT></H2>
<b> Arguments and Result</b><BLOCKQUOTE>
The arguments and result are simple numeric arrays. For two nonempty arguments, the result is integer if both arguments are integer and all result elements lie inside the range of integer representation, and floating point otherwise. If exactly one argument is empty, the result is floating point if that argument is floating point, and otherwise its type is the type of the nonempty argument. If both are empty, then if one is floating point and the other integer the result is floating point, and otherwise its type is the type of the right argument.<P>
</BLOCKQUOTE><b> Definition</b><BLOCKQUOTE>
<font face=Kapl>y</font> minus <font face=Kapl>x</font>.<P>
</BLOCKQUOTE><b> Example</b><BLOCKQUOTE>
<pre><A NAME=109><font face=Kapl> 1 0 99.5 1e308 - .5 1 .5 1e308
1.5 1 99 Inf</font></pre></BLOCKQUOTE>
<HR>
<ADDRESS><table width="100%"><tr><td><font size=2><i><a href="mailto:doc@aplusdev.org">doc@aplusdev.org</a></i></font></td><td align=right><font size=2><i>© Copyright 1995–2008 Morgan Stanley Dean Witter & Co. All rights reserved.</i></font></td></tr></table></ADDRESS>
</BODY>
</HTML>
|