Re:Numbering should start at zero: E.W. Dijkstra
by venusenvy47 on Friday March 21, 2025 @09:55AM
(#43435752)
Just speaking anecdotally, I had the impression that math people prefer 1-based indexing. I've heard that Matlab is 1-based because it was written by math majors, rather than CS majors.
Re:Numbering should start at zero: E.W. Dijkstra
by Aardwolf on Friday March 21, 2025 @10:25AM
(#43436085)
Yes but I think it might be just habit, and it's exactly in matlab that dealing with for loops over sub matrices is so annoying due to this
Re:Numbering should start at zero: E.W. Dijkstra
by BeetleB on Friday March 21, 2025 @01:05PM
(#43438234)
Indeed. I was going to point out that mathematicians choose the index based on whatever is convenient for their problem. It could begin at -3, 2, or whatever. I've never heard a mathematician complain that another mathematician is using the "wrong" index. That's something only programmers seem to do.
Re:Numbering should start at zero: E.W. Dijkstra
by shiandow on Friday March 21, 2025 @09:27AM
(#43435414)
In mathematics, if it matters what index your matrix starts on then you're likely doing something wrong.
Besides, in the rare cases where it does matter you're free to pick whichever is convenient.
Also, the origin is at 0, not at 1. If you begin at 1, you've already moved some distance away from the origin at the start.