+ y (Conjugate)

Back to: Vocabulary

The complex conjugate (+z) of the numeric quantity: z

If z is real, then + behaves like Same (]) -- the identity function.

   + 7 0 _7
7 0 _7

Complex conjugates are a pair of complex numbers, both having the same real part, but with imaginary parts of equal magnitude and opposite signs.
http://en.wikipedia.org/wiki/Complex_conjugation

J supports complex numbers and returns them as required. The way to write the scalar numeral with real part 3 and imaginary part 4i is: 3j4.

   sqrt=: 3 : 'y^0.5'  NB. (sqrt y) is y to the power of 0.5
   sqrt=: ^&0.5        NB. (tacit alternative)
   sqrt 49
7
   sqrt _1
0j1
   + sqrt _1
0j_1
   |sqrt _1   NB. The sq root of _1 has magnitude 1
1
   | z=: 3j4  NB. vector repn of z is 3-4-5 triangle
5             NB. hence its magnitude is the hypotenuse
   + z
3j_4
   | +z       NB. Conjugate of z has same magnitude as z
5

Animation Illustrating Conjugate (+)

Embedded application/x-shockwave-flash

Common uses

1. To test z is real not complex:

   if. z=+z do.
      ...
   end.

2. Wherever the complex conjugate of a number is required.

Thus, to find the real part of z, you might think to use

   z=: 3j4 
   -: z+ +z   NB. (-:) is: Halve
3

though you'd normally separate a complex number into real and imaginary parts using Real/Imaginary (+.).

See Also


x + y (Plus)

Back to: Vocabulary

The sum (x+y) of two numeric nouns: x and y .

Either or both of x, y can be scalar.

   x + y [ x=: 5 [ y=: 2 3 4
7 8 9
   x + y [ y=: 5 [ x=: 2 3 4
7 8 9

If both x and y are vectors, they must have the same number of entries (along the leading axis/axes) or length error results.

   x + y [ x=: 100 200 [ y=: 2 3$i.6
100 101 102
203 204 205
   x + y [ x=: 100 200 300 [ y=: 2 3$i.6
|length error
|   x    +y[x=:100 200 300[y=:2 3$i.6

Note however the use of Rank (") to match-up x and y along axis 1 instead of (default) axis 0 --

   x +"1 y
100 201 302
103 204 305

Animation Illustrating Plus (+)

Embedded application/x-shockwave-flash

Common uses

To sum two numeric quantities

   100 + 0 1 2
100 101 102

To sum the entries of a numeric vector

   +/0 1 2 3
6

See Also

Additional animations

See: ../plus/Animations for additional trial animations to represent Conjugate and Plus.


CategoryVoc

Vocabulary/plus (last edited 2011-06-06 18:26:11 by IanClark)