* Signum - Times
>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Voc
!:
Help
Dictionary
Signum
* 0 0 0
Times
*y is
_1 if
y is negative,
0
if it is zero,
1 if it is positive; more generally,
*y
is the intersection of the unit circle with the line from the origin
through the argument
y in the complex plane. For example:
*_3 0 5 3j4
_1 0 1 0.6j0.8
The comparison with zero is tolerant, as defined by the
phrase
(y%|y)*t<:|y where
t denotes the tolerance.
The fit conjunction applies to signum, as in
*!.t .
* denotes multiplication, defined as in elementary mathematics
and extended to complex numbers as usual:
t=:+.x,y [ x=:2j4 [ y=:5j3
r=:-/*/t [ i=:+/ . * t
(x,:y);t;r;i;(r j. i);(x*y)
+---+---+--+--+-----+-----+
|2j4|2 4|_2|26|_2j26|_2j26|
|5j3|5 3| | | | |
+---+---+--+--+-----+-----+
Signum is useful in effecting selections. For example:
* y=: _4 0 4
_1 0 1
>:@* y
0 1 2
f=: %:
f ^: * " 0 y NB. Inverse of f, Identity, or f
16 0 2
(* y) { ;:'Yes No Maybe' NB. Select using Indexing ({)
+-----+---+--+
|Maybe|Yes|No|
+-----+---+--+
g=: <:`-:`+:@.*"0 NB. See Agenda (@.)
g y
_8 _1 2
The dyad
* used on a list and a table illustrates the significance
of
agreement, as discussed in
Section II B:
m=: i. 3 4 [ v=: 3 2 1
m ; (v*m) ; (m*v) ; (+/ m*v) ; (v +/ . * m)
+---------+----------+----------+-----------+-----------+
|0 1 2 3|0 3 6 9|0 3 6 9|16 22 28 34|16 22 28 34|
|4 5 6 7|8 10 12 14|8 10 12 14| | |
|8 9 10 11|8 9 10 11|8 9 10 11| | |
+---------+----------+----------+-----------+-----------+
>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Voc
!:
Help
Dictionary