[]RSS

About Archives Artwork Comic Contact Philosophy Projects Tags

The etymology of i, j, k, …

December 18th, 2007 in Micro Blog

History is fun. Where does the variable naming convention of using i, j, k, l, m, and n for loop variables come from?

In Fortran, all variables starting with the letters I, J, K, L, M and N are integers by default. Fortran refers to this as “implicit typing”. (This may be the source of the long tradition of using “i”, “j”, “k” etc as the loop indexes of “for loops” in many programming languages—few of which have implicit typing). However, it is questionable as the root source. Why were I, J, K, L, M, and N integers in Fortran as opposed to A, B, C or X, Y, Z? One posed explanation is that I and N are the first two letters of Integer. Fortran’s source of inspiration is very likely that mathematicians have been using use i, j, k, … to denote integers for hundreds of years — for example as the Index Variable in Summation and Product. – Wikipedia on Sigils

One Response to “The etymology of i, j, k, …”

  1. eldila says:
    December 18th, 2007 at 10:16 am

    I always think about the Cartesian coordinate system when I think of i, j, and k in for loops.

    $ vec{r} = x hat{i} + y hat{j} + z hat{k} $

    Fortran makes more sense though.

 

Leave a Reply

Subscribe to comments