Complex (function)

is a dyadic scalar function which combines its arguments into a complex number having with the left argument as real part and the right argument as imaginary part. It was added to J as  together with initial support for complex numbers, and was adopted in Extended Dyalog APL using the glyph   because it was seen as a type of numerical composition  for the circular  domain. Complex shares its glyph with Imaginary which is equivalent to applying Complex with a left argument of 0.

History
The question of whether to include this function is one of Roger Hui's 50 exercises in APL language design: "Complex numbers can be constructed as ordered pairs of real numbers, similar to how integers can be constructed as ordered pairs of natural numbers and rational numbers as ordered pairs of integers. For complex numbers, plays the same role as   for integers and   for rational numbers." In a later blog post, Hui quoted Adám Brudzewsky: (…) I’d probably go for  because:


 * it is more clearly related to  (for which the monadic form is also a simple multiplication)
 * it consists of two overstruck basic APL symbols
 * it looks more harmonic (in my eyes)

Oh, and Euler’s formula turns out beautiful (to my taste) with it: Hui continues: On further reflection, I like the  symbol for. If there are existing interpretation of it this one should predominate, if the function is as important as I think it is. (Peer to  and , etc.)

Moreover, complex numbers are commonly represented by magnitude and phase. So if you have a magnitude and phase, how do you get the number so represented? Why  (or  ) of course. And what symbol would you use? (Monadic, with a default magnitude of 1, gets you a point on the unit circle.)

Examples
Try it online!

Documentation

 * J Dictionary, NuVoc