+. y (Real / Imaginary)

Back to: Vocabulary

Decomposes complex numbers into real and imaginary parts.

   +. 3j5
3 5
   +. 3j5 4j7
3 5
4 7
   +. 2 2$ 3j5 4j7 2j1 8
3 5
4 7

2 1
8 0

This following is an animation that might be useful to those new to J

Embedded application/x-shockwave-flash

Common uses

Handling complex numbers.

See Also


x +. y (GCD (Or))

Back to: Vocabulary

The logical operation Or between two Boolean nouns x and y.

In the more general case where x or y are not Boolean, the result is the Greatest Common Denominator (GCD) of x and y.

   0 0 1 1 +. 0 1 0 1
0 1 1 1
   (0 1) +./ (0 1)      NB. Truth-table of: +.
0 1
1 1
   (0 1) +.table (0 1)  NB. Truth-table with borders
┌──┬───┐
│+.│0 1│
├──┼───┤
│0 │0 1│
│1 │1 1│
└──┴───┘
   +. table i.13        NB. table defaults x to: y
┌──┬─────────────────────────────┐
│+.│ 0 1 2 3 4 5 6 7 8 9 10 11 12│
├──┼─────────────────────────────┤
│ 0│ 0 1 2 3 4 5 6 7 8 9 10 11 12│
│ 1│ 1 1 1 1 1 1 1 1 1 1  1  1  1│
│ 2│ 2 1 2 1 2 1 2 1 2 1  2  1  2│
│ 3│ 3 1 1 3 1 1 3 1 1 3  1  1  3│
│ 4│ 4 1 2 1 4 1 2 1 4 1  2  1  4│
│ 5│ 5 1 1 1 1 5 1 1 1 1  5  1  1│
│ 6│ 6 1 2 3 2 1 6 1 2 3  2  1  6│
│ 7│ 7 1 1 1 1 1 1 7 1 1  1  1  1│
│ 8│ 8 1 2 1 4 1 2 1 8 1  2  1  4│
│ 9│ 9 1 1 3 1 1 3 1 1 9  1  1  3│
│10│10 1 2 1 2 5 2 1 2 1 10  1  2│
│11│11 1 1 1 1 1 1 1 1 1  1 11  1│
│12│12 1 2 3 4 1 6 1 4 3  2  1 12│
└──┴─────────────────────────────┘

This following is an animation for the Or (boolean) that might be useful to those new to J

Embedded application/x-shockwave-flash

Common uses

To form a conditional statement

if. (0=#y) +. (y=0) do.
  ...

To test if x and y are relatively-prime (result will be 1 if so)

   12 +. 20
4

See Also


CategoryVoc

Vocabulary/plusdot (last edited 2011-06-17 00:53:49 by IanClark)