# Vocabulary/jdot

 j. y Imaginary

Rank 0 -- operates on individual atoms of y, producing a result of the same shape -- WHY IS THIS IMPORTANT?

Multiplies y by 0j1, which represents the imaginary unit i .

Equivalent to `0j1 * y`

```   j. 5           NB. y real, resulting in the pure imaginary number 0+5i
0j5
5 * 0j1
0j5
j. 3j4         NB. y complex, result is the product (0+1i)*(3+4i) = 3i+4i^2 = -4+3i
_4j3
j.(^:4) 3j4    NB. each step rotates the vector by π/2
3j4
```

 x j. y Complex

Rank 0 0 -- operates on individual atoms of x and y, producing a result of the same shape -- WHY IS THIS IMPORTANT?

Combines x and y into a complex number having x as its real part and y as its imaginary part

Equivalent to `x + 0j1 * y`

```   3 j. 4       NB. arguments are separated from verb by spaces (x j. y)
3j4                                                               ^  ^
3j.4         NB. this is a different number, complex constant (3+0.4*i)
3j0.4
1 j. -:%:2   NB. composing complex number (1+sqrt(2)/2*i)
1j0.707107
```

### Common uses

1. Work with complex arithmetic.

2. Some primitives use a complex argument as a way of putting two numbers into one atom

```                         NB. (":) Format
o.>:i.3                                NB. first three multiples of π
3.14159 6.28319 9.42478
(o.>:i.3) ,: (*: o.>:i.3)              NB. multiples and their squares
3.14159 6.28319 9.42478
9.8696 39.4784 88.8264
13j9 ": (o.>:i.3) ,: (*: o.>:i.3)      NB. x is (w j. d), producing formatted output
3.141592654  6.283185307  9.424777961   NB. with d decimal digits and a field width of w
9.869604401 39.478417604 88.826439610

NB. (#) Copy
2j1 # 2 3 5 7                          NB. x is (n j. f), specifying n copies followed by f fills
2 2 0 3 3 0 5 5 0 7 7 0
0 2j1 1 3 # 2 3 5 7
3 3 0 5 7 7 7

NB. (i:) Steps
i: 2j3                                 NB. y is (a j. n), calling for n steps in intervall [-a,a]
_2 _0.666667 0.666667 2
```

3. Handle x/y screen coordinates as complex numbers instead of pairs of reals.

```   j4xy=: _2 j./\ ]   NB. a list of xy-coords --> a list of complex nos
xy4j=: [: , +.     NB. a list of complex nos --> a list of xy-coords
j4xy 3 4 _2 3
3j4 _2j3
xy4j 3j4 _2j3
3 4 _2 3
```

### Related primitives

Real/Imag (+. y), Signum (Unit Circle) (* y), Length/Angle (*. y), Magnitude (| y), Circle Functions (x o. y), Angle * Polar (r.)