Video Annotation Script for Lesson #2 – Idiosyncratic Introduction

Video annotation of the J labs round 2. Following is the text of the lab as it is presented in ‘An Idiosyncratic Introduction to J’.

── (2 of 15) Functions ────────────────────────────────── There is a rich set of primitives. ) 2 + 3   5 2 - 3   _1 2 * 3   6    2 % 3   0.666667    2 ^ 3   8    2 ^ 0.5   1.41421   _2 ^ 0.5   0j1.41421    2 ^. 3   1.58496

Wow, I learned a ton creating the video for the first lesson. Most important was the difference between the spoken word and the written word. I will probably need to go through the same process this time, but here is a first draft for a script of the video annotation of this lesson. It involves more animation as concepts are presented visually and these are noted within brackets. The script follows in blue text.

Ah, now to explore how J notation conveys those mathematical ideas. Primitives are functions defined by the creators of the J language. Let’s take a quick look at the examples.

2 + 3, no surprise here, the answer is 5, but then 2 – 3 shows us J’s way of showing negative numbers. In standard math notation, we think of -1 as the number 1 with the – operator applied to move it to the left of the number line (animation). It’s as if we use the positive number line and the ‘-‘ function to create the full number line. In J, one unit to the left of the origin has its own name, _1. Applying the – operator to any value moves the result to the opposite side of the origin, but now we have two valid starting points –  1 and _1 and the ‘-‘ function feels more symmetrical.

The next lines show that J uses * as the multiplication operator and % as the division operator. The second choice is a little strange but it includes the recognizable division slash  and it can be shown on one line, unlike the vertical fraction representation of division(animation).

Using ^ as the exponentiation operator is also nice since superscripts and offset lines are no longer needed (animation of 23 to 2^3). 2^3 and 2*2*2 are both 8.

There are two things to keep in mind when raising bases to fractional powers. First is that decimal fractions require a leading zero, here creating an exponent of one half also known as the square root. The second has to do with the square root result. For positive numbers this is pretty straight forward, but the square root of a negative number requires complex numbers, which J expresses in two parts, separated by the letter j. The first part (the real part) can map to the x axis and the second part (the imaginary part) maps to the y axis. By definition, multiplying a number by 0j1 rotates it around the origin (animation) by 90 degrees, so multiplying by 0j1 twice moves it to the opposite side of the number line, effectively making it negative. By multiplying 2^0.5 by 0j1 we get 0j(2^0.5) and 0j(2^0.5) * 0j(2^0.5) becomes ((0j1)^2)* 2 or _2, so 0j(2^0.5) is the square root of negative 2.Using ^ as the exponentiation operator is also nice since superscripts and offset lines are no longer needed (animation of 23 to 2^3). 2^3 and 2*2*2 are both 8.

Finally we see the base function ‘^.’ ; made up of the characters ‘^’ and ‘.’ that express the log of a base. For 2 ^. 3 the answer 1.58496 means 2 ^ 1.58496 is 3. Notice that ^ and ^. are related mathematically to each other and differ by a single period called an inflection. The other inflection character that J uses is the colon, ‘:’. Inflections group similar functions together .


I am particularly wondering about including the complex numbers explanation with regard to the square root of negative numbers. Should it be shortened or lengthened? Right now it seems a bit lost to me. I look forward to your comments.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s