Re:Is Fortran better than Python for teaching basics of nume...
by Skeime on Wednesday September 24, 2025 @03:15AM
(#45357271)
Dijkstra is right, of course. However, most math texts still use 1-based indexing. If you want to translate them into code, it's easier when the conventions match.
(Now, if you had a proposal for switching math over to 0-based indexing ...)
Re:Is Fortran better than Python for teaching basics of nume...
by scheme271 on Wednesday September 24, 2025 @04:47AM
(#45357824)
Good luck getting a community with literally hundreds of years of literature using 1 based indexing to change.
Re:Is Fortran better than Python for teaching basics of nume...
by Skeime on Thursday September 25, 2025 @12:00PM
(#45374480)
I did have one or two math professors who would use x_0 and x_1 instead of x_1 and x_2 when they had to name two objects.
But I have also seen places where 1-based indexing was used despite being "obviously wrong". I don't quite recall what it was, but there was sequence of objects A_1, A_2, ... and a natural way of combining A_k and A_l to get A_(k + l - 1). Had the indices been shifted by 1 to be 0-based, the result would have been A_(k + l), which would be much nicer to work with.
Re:Is Fortran better than Python for teaching basics of nume...
by toolslive on Wednesday September 24, 2025 @09:51AM
(#45360381)
He (Dijkstra) even mentions this in the article:
> The above has been triggered by a recent incident, when, in an emotional outburst, one of my mathematical colleagues at the University —not a computing scientist— accused a number of younger computing scientists of "pedantry" because —as they do by habit— they started numbering at zero.
Re:Is Fortran better than Python for teaching basics of nume...
by loiseaujc on Wednesday September 24, 2025 @08:09AM
(#45359190)
OP here. 0-based vs 1-based indexing is one these hot debates I don't want get in as I've mentioned in the post. Yet, point is, if you take pretty much any math textbook, indexing starts at 1, whether we like it or not. And for many students, understanding the mechanics of a given algorithm is already enough of an effort that they do not need, on top of that, to translate every indices in the book's pseudo-code from 1-based to 0-based. That's all I'm saying. No other value judgement.
Re:Is Fortran better than Python for teaching basics of nume...
by potbelly83 on Wednesday September 24, 2025 @01:22PM
(#45363337)
Doesn't fortran also support the ability to define arrays with arbitrary bounds i.e. (-4, 5) which is quite difficult todo in other languages
Re:Is Fortran better than Python for teaching basics of nume...
by pklausler on Wednesday September 24, 2025 @02:54PM
(#45364525)
Yes, but pitfalls were added to the feature in Fortran '90 and it should now be generally avoided.
Re:Is Fortran better than Python for teaching basics of nume...
by TheRealKing on Thursday September 25, 2025 @11:25AM
(#45373895)
I strongly disagree. Arbitrary bounds are tremendously helpful in dealing with arrays whose starting point must be offset.
Re:Is Fortran better than Python for teaching basics of nume...
by pklausler on Thursday September 25, 2025 @05:59PM
(#45379724)
I didn't say that they were not helpful; I said they have dangerous pitfalls. Also, they're not perfectly portable. My testing shows that only two compilers get lower bounds right in all the tricky cases that I know of.
I'm with Dijkstra on this one. https://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831...