J can solve any arithmetic problem that a pocket calculator or calculator app can solve, only you enter the numbers as an interpreter line command. Suppose you wanted to find out how many seconds there are in a day. The problem would be 60 seconds times 60 minutes in an hour times 24 hours in a day. Unlike, a button calculator program, you can calculate it with one command in J. You enter each command line followed by the [enter] or [return] key and the interpreter displays the answer (or an error message) below as follows:

***/60 60 24** ; This J command: (*) Multiplies (/) All of the following numbers

86400 ; this is the answer you get from J.

J can go from simple multiplication to complex calculus. My purpose here is to suggest a few introductory tools in J that both help you improve basic math knowledge, help start your children off with a better footing in math, and demonstrate the power of J to solve complex math problems.

The current version of J is available here. Previous editions of J are available here. If you have problems, I suggest you revert to an earlier version, say 602. J requires javascript to run, and I’ve had a lot of problems with javascript on Mac computers.

J and APL are interpreters. Using an interpreter, you type in a command (telling the computer to do something), press [enter] or [return]. Then, the program executes that command. In earlier days, the interpreters were widely used to combine commands and data to process information. Other examples of interpreter software were the BASIC, REXX, and DOS Batch file language interpreters. J, like the other programs mentioned allow routines of instructions to be saved in files and run as needed. I’ll demonstrate both a direct command and a very simple program routine in J.

Below is a simple example of using J to create a multiplication or times table. This example serves two purposes. First, I don’t doubt that many people are emerging from school with a very shaky grasp of elementary arithmetic. People are failing in school not because they don’t know calculus, but because they don’t know arithmetic. Second, this example also shows the sheer power of J to do advanced mathematics in a way that reduces drudgery and errors.

Once you are in the J interpreter and the cursor is at the indent, you can proceed to enter the commands. What we will tell the interpreter to do first is to create an index of numbers. Enter the command below at the prompt. It assigns to the variable x the index of numbers from 1 to 12:

**x =: 1 + i.12 [enter]**

Note that the reason you need to add 1 (1+) is that arrays in J start with zero. Without the 1+ the index would start with 0 and end with 11. Next, you can verify that x is what you think it is by typing x.

**x** [enter] ; If the assignment is correct, the display should be as follows:

1 2 3 4 5 6 7 8 9 10 11 12

Then, you can enter the command that creates the times table, by multiplying x times x. Using the multiply command (*) with the scan command (/) to multiply all the numbers by all the numbers. This command creates a two dimensional table.

**x */x** [enter] ; multiply the index of x times the index of x. This creates the table.

1 2 3 4 5 6 7 8 9 10 11 12

2 4 6 8 10 12 14 16 18 20 22 24

3 6 9 12 15 18 21 24 27 30 33 36

4 8 12 16 20 24 28 32 36 40 44 48

5 10 15 20 25 30 35 40 45 50 55 60

6 12 18 24 30 36 42 48 54 60 66 72

7 14 21 28 35 42 49 56 63 70 77 84

8 16 24 32 40 48 56 64 72 80 88 96

9 18 27 36 45 54 63 72 81 90 99 108

10 20 30 40 50 60 70 80 90 100 110 120

11 22 33 44 55 66 77 88 99 110 121 132

12 24 36 48 60 72 84 96 108 120 132 144

If you want to save this times table as a J function, at least for the session, type:

**m =: x */ x ** [enter] ; This assigns to m the multiplication of the index x by itself:

**m** [enter] ; run m

1 2 3 4 5 6 7 8 9 10 11 12

2 4 6 8 10 12 14 16 18 20 22 24

3 6 9 12 15 18 21 24 27 30 33 36

4 8 12 16 20 24 28 32 36 40 44 48

5 10 15 20 25 30 35 40 45 50 55 60

6 12 18 24 30 36 42 48 54 60 66 72

7 14 21 28 35 42 49 56 63 70 77 84

8 16 24 32 40 48 56 64 72 80 88 96

9 18 27 36 45 54 63 72 81 90 99 108

10 20 30 40 50 60 70 80 90 100 110 120

11 22 33 44 55 66 77 88 99 110 121 132

12 24 36 48 60 72 84 96 108 120 132 144

There you have it, a 12 x 12 multiplication table. This is a highly useful reference for elementary arithmetic. If you were to study more advanced mathematics, the ability to set up and learn to use these index and matrix features of J would take a great deal of the drudgery and error out of advanced mathematics. I apologize for the raggedy look of the multiplication table. I’m still figuring out the WordPress implementation of html and I can’t seem to get the right combination of commands to get the table to line up properly. In J, it lines up perfectly.

The next topic in this series on J will be on how to use the random number generator to create practice math problems. To paraphrase W. Michael Kelley, one of the finest math instructors I have read, “The only way to learn … math is to do… math problems…A lot of them….Sorry!” I’m NOT sorry. I agree. Mike Kelley will be featured in future discussions of mathematics. Meanwhile, in addition to using a random number generator to generate practice problems, we will show how to use J to check the answers in an easy to understand way.