>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary
Real / Imaginary |
+. 0 0 0 |
GCD (Or)
|
+.y yields a two-element list of the real and imaginary parts of
its argument. For example, +.3j5 is 3 5,
and +.3 is 3 0 .
|
|
x+.y is the greatest common divisor of x
and y . If the arguments are boolean (0 or 1),
the functions +. and *. are equivalent to logical or
and and. The function -. similarly restricted
is not.
|
]y=: i+2*j. i=: i.4
0 1j2 2j4 3j6
+. y
0 0
1 2
2 4
3 6
The greatest common divisor divides both of its
arguments x and y to produce results that have
no common factor, that is, the GCD of the quotients is 1.
Moreover, these quotients represent the fraction x%y in lowest form.
For example:
x=: 24 [ y=: 60
x;y;(x +. y);((x , y) % (x +. y))
+--+--+--+---+
|24|60|12|2 5|
+--+--+--+---+
lff=: , % +. Gives lowest form of fraction
x;y;(x lff y);(%/x lff y);(%/x,y);(+./x lff y)
+--+--+---+---+---+-+
|24|60|2 5|0.4|0.4|1|
+--+--+---+---+---+-+
Since the functions =| and =<.
(tests for non-negative and for integer) produce boolean results,
the phrase (=|)+.(=<.) is a test for non-negative or
integer:
(test=: (=|) +. (=<.)) _2 _2.4 3 3.5
1 0 1 1
The duality of or and and may be shown as follows:
d (+./ ; *.&.-./ ; *./ ; +.&.-./) d=: 0 1
+---+---+---+---+
|0 1|0 1|0 0|0 0|
|1 1|1 1|0 1|0 1|
+---+---+---+---+
>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary