APL & Array programming

Meaning pairings fall into these three groups:

Monadic form is like dyadic form with a default left argument

Glyph Default left argument
+ 0J¯2×11○x i.e. −2∙Im(x)
- 0
× ÷(|x)+x=0 i.e. (|x|+[x=0])⁻¹
÷ 1
* *1 i.e. e
*1 i.e. e
, (for scalars and vectors only)
? 1 (almost; scalar vs vector)
⎕UCS 0,⍳111411
⎕UCS 0,⍳111411
∘.=⍨⍳≢x i.e. In
,1 (almost, scalar vs vector)

Both forms are good fit for the glyph

Glyph Explanation
indicates (3) layers of depth for the monadic form
indicates a counting rod marking for the monadic form
take elements and increase rank
drop elements and decrease rank
element of” and “enlist”
“enclose at positions where condition is met” and “enclose on condition of being simple”
indices where elements fit into intervals” and “indices where true”
,[1]x (for non-scalars) and ,⍤¯1 (for higher-rank arrays)

The two forms are conceptually related

Glyph Relationship
next higher integer or highest argument
next lower integer or lowest argument
| both forms can be called modulo and use the symbol: |x| and a|b
! factorial is prominent in the formula for binomial
both the trigonometric functions and π relate to the (unit) circle
~ “not” and “but not”
monadic means “not equal to any preceding item”
shape and reshape
indices of and index of
rotate and mirror along last axis
rotate and mirror along first axis
format and format with specification

Wow this is extremely helpful! Is that in the dyalog docs or aplwiki someplace?

It wasn’t. But I’ve now added it to the APL Wiki page on mnemonics, where you can also find other lists you may find useful.


I installed both Dyalog and RIDE on linux Mint. I can fire up Dyalog no problem. I can start the RIDE but it wants to “connect” to something on port 4502, and i don’t know how to point it to the running instance of Dyalog.

do I start dyalog in a terminal window with specific parameters and then point RIDE to that port for the IDE to talk to it?

EDIT: Ok, so I “kind of” figured it out, but “my solution” seems super convoluted:

  • I started RIDE and selected Type dropdown to: Listen
  • Then clicked the LISTEN button that appears under it, that gave me the instructions on how to start the Dyalog interpreter

Please start the remote interpreter with


in its environment, so it connects here.

  • Then went to a terminal window and started the dyalog like so:
    – dyalog RIDE_INIT=connect:localhost:4502
  • This finally starts the familiar RIDE/Dyalog interface that I’m used to on MacOS with all the nice symbols at the top.

NOTE: If I copied the string from the dialogbox on the RIDE side it wouldn’t work, it has to have a proper hostname and localhost works fine as both processes are running on the local host (in 99.999 % of the use cases)

One thing I don’t understand is: Why doesn’t RIDE just fire up the interpreter itself and then connect to it? it can easily check if it’s installed and if it’s installed, there’s no difference in me going over to another shell window or it just firing one up? I’m sure there’s a good reason it’s set up to be like this though.

1 Like

You can let RIDE start Dyalog by selecting “Start” from the “Type:” selector. Specify parameters directly from the last box on that screen, and save various sets of settings to “profiles”.

Anyway, to answer your first question: just start Dyalog with RIDE_INIT="SERVE::4502"

1 Like

Interesting. The first time I chose “start” It couldn’t find the interpreter. Now that I’ve played around with the other option of connecting back to the RIDE from Dyalog started in a shell , I can select “Start” and it does find the interpreter. I think some config was missing and when I connected back from console to RIDE it may have tied those confg loose ends and now RIDE can see the interpreter.

1 Like

think it should be in quotes
aka: RIDE_INIT=“connect:host:4502”

1 Like

Sure you can.


Hi Jeremy, I did a quick “stocktake” after Session 13. The following list of glyphs has not been covered yet.

⍟⌹○!? ⊥⊤ <> ∨∧⍲⍱ ⊃⌷⍋⍒ ⍸∊⍷∪∩~ ⍀ ⌽⊖⍉ .@ ⍞⎕⍠⌺⌶⍎⍕ ⋄→∇& ¯⍬∆⍙

There is a placeholder for Slope Bar. But, the examples are the same as Slash Bar


Thanks for putting this together Sarada!

1 Like

Complex number manipulation can be easier in polar coordinate. For example Euler identity exp(j pi) = -1 can be interpreted naturally in the polar coordinates as shown below.

Multiplication and power also follow naturally.

Are there any good places to understand the basic ideas here? I’m not able to follow your diagram because I don’t know anything about what’s going on in it.

Wikipedia covers polar complex plane here: Complex number - Wikipedia
The image is basically the same image that you’ve drawn during the course (horizontal axis real, vertical axis is imaginary).

I have never in my life managed to learn any math by reading a wikipedia page – I think they’re written for people that understand a lot more math than me!

Wikipedia descriptions can be good or bad depending on who has written them (in this case I found it concise and helpful). I was hoping that my handwritten summary does the job (apparently not).
Here is another one that covers the polar representation of complex numbers: https://mathvault.ca/euler-formula/

The link above offers 3 different proofs for exp(a.j) = cos(a) + j sin(a) (I like the calculus proof)
Once you accept that, the polar representation of a complex number follows (ie, a is the angle that the complex number makes with the horizontal axes).
Once you accept the polar representation, the multiplication and power become easy to compute.

Thank you. That’s getting closer to the level of detail I need. There’s some things assumed there that I kinda know, but need to understand better:

  • a unit complex number to a power can be thought of as repeated multiplications
  • For a complex variable z, the power series expansion of e^z
  • all non-zero complex numbers can be expressed in polar coordinates in a unique way (but I’m not sure how to work with them in that form)
  • power series expansion of e^z: if you don’t want to start from the series expansion of e^z as a given, you can use the “calculus proof” of exp(a.j) = cos(a) + j sin(a) given in the reference above to be convinced that the equality holds. Then, the series expansion of exp(a.j) follows from series expansions of sin and cos
  • Representation in polar coordinates follows from the same equation exp(a.j) = cos(a) + j sin(a). It’s not quite unique because, for example, r.exp(j.a) = r.exp(j.(a+2k.pi)) for all integer k
  • Power as repeated multiplication: That’s true for integer exponent, but the power definition also applies to non-integers and non-rational number where the “repeated multiplication” equivalence does not hold.

Working with complex numbers in polar coordinate makes power and multiplication a bit easier. For example (to use your example in the APL session yesterday):

(1 +1j)^2 = [sqrt(2)exp(j.pi/4)]^2 = 2.exp(j.pi/2) = 2 . j

Sorry I’m not saying that I don’t understand why those 3 things have those implications. I’m saying I don’t really understand what those 3 things are at all.

There is much too much text for me to parse on this page: https://mathvault.ca/euler-formula/

I’ve got some links below that I think are sufficient to understand the exponential-notation for complex numbers, but I thought perhaps some additional annotation and colourisation of the original pic might help. I’m not sure what I ended up with is useful or a dogs breakfast.

To understand exponential-notation of complex numbers, all you need is:

  1. A good understanding “what ‘e’ is” and why the "derivative of ‘e’ is also ‘e’ ":
    e (Euler's Number) - Numberphile - YouTube

  2. Then understand how the derivative of e makes this a good representation of the unit circle in the complex plane: e^(iπ) in 3.14 minutes, using dynamics | DE5 - YouTube

  3. Then multiplying complex numbers “x” and “y” consists of:
    – multiplying their amplitudes
    – adding their angles (high school maths, but for completeness: Multiplying Powers - YouTube)


Thanks @bencoman ! This looks like the key insight

(You call that high school math, but I’m not sure we covered that in high school… or at least I don’t remember doing so)

1 Like