Remix.run Logo
▲ jandrewrogers 7 hours ago

FORTRAN is also the origin of using 'i', 'j', 'k', etc as loop variables in code, since 'i' was the first variable name that could be used for that purpose. The original language design was constrained by very primitive computers.

▲throw-the-towel 7 hours ago | parent | next [-]

i has been the default variable for sum notation in mathematics long before FORTRAN. Here's an example dating from 1838: https://www.numdam.org/item/JMPA_1838_1_3__508_0.pdf

▲fph 2 hours ago | parent | next [-]

It might actually be the other way round: Fortran adopted the convention that i,j,k are integer variables because that was the standard in maths.

▲vintagedave 5 hours ago | parent | prev [-]

Where in that doc, sorry? I thought I spotted something then realized it may have been a ‘1’.

▲tyromaniac 7 hours ago | parent | prev | next [-]

Is that really true, if so, what's your basis? Fourier used i for the same purpose, and it definitely became a pretty standard indexing variable long before the 1950s. Most early code written in FORTRAN was essentially just transcribing formulae and algorithms that already would use such variable names.

▲jibalt 7 hours ago | parent | prev | next [-]

The original language design was constrained by primitive thinking and lack of experience. The nature of computers in 1957 had no bearing on such things as variable names starting with I-N being implicitly integers ... that followed existing mathematical practice.

▲jleyank 7 hours ago | parent [-]

"that followed existing mathematical practice". Not what I would call primitive thinking. It set out to handle math quickly and it succeeded. I/O wasn't its strength, and I'm sure the latest versions look like verbose C.

▲jibalt 6 hours ago | parent [-]

[flagged]

▲whartung 7 hours ago | parent | prev | next [-]

The reason 'i' was the first letter available was because by default identifiers starting with, I think, I-N were integers instead of float.

When I first started, with BASIC, my variable of choice was T simply because it was easy to type NEXT T in the FOR loops (why not R? I dunno...T just stuck).

▲kps 4 hours ago | parent [-]

Other way around. I–N were integers rather than float because mathematics convention uses i, j, … as indices and n, m as sizes or counts.

▲eichin 3 hours ago | parent [-]

The joke "God is Real (unless declared integer)" is definitely fortran-specific, though :-)

▲392 5 hours ago | parent | prev [-]

origins are very relative, it seems to have [started a bit before](https://stats.stackexchange.com/questions/176965/what-do-i-a...) :D