I just stumbled upon the J programming language, which has the description:

J is particularly strong in the mathematical, statistical, and logical analysis of data. It is a powerful tool in building new and better solutions to old problems and even better at finding solutions where the problem is not already well understood.

which sounds promising.

However, I looked at some examples, and my reaction was "you've got to be joking". E.g. here's an investigation into the Collatz problem (source):

   collatz=: -:`(>:@(3&*))`1: @. (1&= + 2&|)

   collatz 9
   collatz 28
   collatz 1
   collatz^:a: 9
9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1

This makes me feel like it's more intended for code golfing, rather than serious mathematics.

Q: Is the J programming language actually useful for mathematics and mathematicians?

  • $\begingroup$ I thought you meant that language from Pragmatic Programmer's Seven more languages in seven weeks, but that was Julia not J. Julia looked not bad at all. $\endgroup$
    – mvw
    Jul 4, 2014 at 9:04
  • $\begingroup$ Why the "J Programming Language" link points to another apparently unrelated question? $\endgroup$ Jul 4, 2014 at 10:37
  • $\begingroup$ Oops: a copy/paste error. (Fixed now.) Thanks! $\endgroup$ Jul 4, 2014 at 10:55

3 Answers 3


J is very useful. While it has its quirks, once you get used to them, as gar said, you can really understand the language quite well. I consider myself a novice at J, but being exposed to it, I can definitely tell what the example in the accepted answer's "mysterious code". It's easy enough to say you don't know what a program does, that's the same for many languages.

I for one cannot understand, without running it, some C programs, especially ones that rely on pointers, me being mainly a JavaScript programmer. Does that make C useless and unreadable? Granted, J has a higher scale of unreadability, but it still can be readable. There's a line between readable and unreadable, and J lies right on the line.

As for your question, I believe it is very useful for math (I use it for geometry) and mathematicians (it's a nice calculator if you have a computer with you, and are used to it). While you may not appreciate J, I strongly suggest you try learning it. J, APL, etc. can seem like a bunch of nonsense, but it's just another way to program and to learn.

You can stop reading if you're convinced—I'm mainly showing examples now.

J is good for its conciseness. You want a multiplication table for numbers 0 to 10? Boom:


This yields a very appealing table:

0  0  0  0  0  0  0  0  0  0   0
0  1  2  3  4  5  6  7  8  9  10
0  2  4  6  8 10 12 14 16 18  20
0  3  6  9 12 15 18 21 24 27  30
0  4  8 12 16 20 24 28 32 36  40
0  5 10 15 20 25 30 35 40 45  50
0  6 12 18 24 30 36 42 48 54  60
0  7 14 21 28 35 42 49 56 63  70
0  8 16 24 32 40 48 56 64 72  80
0  9 18 27 36 45 54 63 72 81  90
0 10 20 30 40 50 60 70 80 90 100

Want to make it look like a "real" multiplication table (without the zero columns)? No problem:


While this looks like a bunch of jargon to the casual observer, it makes a great deal of sense. Observe:

*/~ 1 + i. 10

i. n makes an integer range $[0, n)$. 1 + i. n creates an integer range $[1, n]$. ~ makes a one-argument function (or monad) take its argument twice, making it a two-argument function (or dyad). E.g., +~ n = n + n and *~ n = n * n or n^2.

/ inserts the function before it (*/multiplication) between every member (so +/ is summation over a list), or, when having two arguments as in +/~, it essentially makes a table in our desired fashion.

While this is only a bit of J, you can see the effect it has for its brevity. It makes calculation swifter and easier—so long as you devote the time to learning it. Which I suggest you do.

  • $\begingroup$ -1 for using 1+ instead of >: and for not mentioning jelly $\endgroup$
    – Kenny Lau
    Apr 27, 2016 at 13:09
  • 4
    $\begingroup$ @KennyLau 1+ is much easier to understand for the casual observer than >:, and jelly is a golfing language. Not precisely useful, requiring a good deal more memorization and special characters. (I don't care about the claim that you can type it with an international keyboard, it's still quite hassle) $\endgroup$ Apr 27, 2016 at 13:11

In my opinion it's not better than other languages like C++ or Fortran. I don't know it very well but I cannot see anything that cannot be done with other "computer" programming languages.

Surely it's not more readable: for example I cannot see clearly what this code does without I see it in action:

G=: 3 : '(0&,. , 1&,.@|.)^:y i.1 0'

and probably if you try to make it more readable you avoid its main feature, because it's very coincisive.

If you want to do some mathematics with computer language, I prefer to use something like Mathematica or Matlab. Even is the free software octave and similare are very powerful.

From a program language point of view, their disadvantage is that they are script code and not compiled one, but I don't care about it for mathematical experiment.

If you want to create some machine native code, I prefer some mainstream programming language, like C++ or even fortran when needed, because if you search you can find libraries for almost everything (more about numeric calculus that symbolic one), like boost::math or biginteger.

At the end, in my opinion it's not useful because it has nothing that cannot be done with other available instruments, and its code syntax its unreadable unless you use it for many months.


My belief is that the language is not meant to write code for others to understand, rather we can save a lot of keystrokes once we get used to the language.

I mainly use J for simulating problems on probability, and also for the fun of functional programming! ( I try to maintain a list of the stackexchange problems simulations on my github profile )


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .