M
mr_vocab
i never got this its always in my tutial bookfor i in range(...)
i never got this its always in my tutial bookfor i in range(...)
i never got this its always in my tutial bookfor i in range(...)
"Index". i.e., the variable will be the index of an array you want to
iterate over.
The usage of "i" was promulgated by the FORTRAN language, which allowed
only single-letter variable names (and was all upper case, too, so it
was actually I). The FOR statement was commonly used to iterate over an
array, and I and J were the commonly used index variables for that
purpose.
Duncan said:The actual reason why everyone uses I and then J as the for loop indexes
was that Fortran, by default, assumed all variables starting with letters
from I-N were integer, and all other variable names were real. Integer
names starting with I was presumably chosen for its mnemonic value and the
other letters then follow on in sequence, presumably far enough for what
the original language designers thought was a reasonable 20:6 split real to
integer variables.
Peter Hansen said:The idea that 'i' is mnemonic for 'integer' is interesting, though.
If the mathematical field is really the origin, rather than FORTRAN,
it would be interesting to know if that was how "they" picked it.
Googling to little avail, the best I could find to help was Hilbert's
1900 address on "23 Mathematical Problems" which he gave to the Int'l
Congress of Mathematics in Paris, proving a usage which predates
FORTRAN by 50-some years.
Richard said:I would assume vector algeba was the origin; Google can go back
to 1843 on that line: http://www.wordiq.com/definition/Quaternion
That suggests that i, j, k notation is an extension of complex notation
so i must be the Euler i (1777) presumably standing for imaginary.
The actual reason why everyone uses I and then J as the for loop indexes
was that Fortran, by default, assumed all variables starting with letters
from I-N were integer,
The usage of "i" was promulgated by the FORTRAN language, which allowed
only single-letter variable names (and was all upper case, too, so it
[...]Dennis said:That must have been a really old version of FORTRAN -- all
versions I've encountered allowed for, at least, 6 significant
characters in variable names. (This goes back to F-IV/F-66). BASIC was
limited to one or two characters.
That must have been a really old version of FORTRAN -- all versions
I've encountered allowed for, at least, 6 significant characters in
variable names. (This goes back to F-IV/F-66). BASIC was limited to
one or two characters.
Dennis said:However, FORTRAN had the "Indian" <G> {my mnemonic for the
range} -- the default for undeclared variables beginning in the range I
.. N is INTEGER. A .. H, O .. Z are REAL/FLOAT.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.