-
-
Notifications
You must be signed in to change notification settings - Fork 557
matrix: Switch to canonical notation of matrix indices #1387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@petertseng curious if you have an opinion one way or the other on this. I have pondered it from time to time over the past couple of weeks and have decided I don't have a real strong opinion one way or the other. |
|
it does not matter to me, therefore I have done nothing with this PR |
|
I would assume that the simplest explanation is the one that uses the indexing rules of the language in use. Since the languages you refer to (Matlab, Fortran, Julia, ...) index by 1, this would be true for them. Changing indexing from 0 to 1 would come as a benefit to those tracks. I would assume they're a minority by numbers, but on the other hand, matrix-based exercises may play a larger role in these tracks. |
|
@sshine actually I don't think @SaschaMann's change is to make the exercise more tailored to Matlab, Fortran, and Julia. I think that may just be a side affect. Some languages use 0, 1 , n based arrays... The goal is just to use a language agnostic way of indicating matrices and indexes that more closely resembles what one may have learned from text books in math class. |
Indeed, this is the goal. (Sorry, I had notifications sent to the wrong email, so I didn't notice the responses earlier) |
|
Seeing no comments against merging or for more changes I am going to go ahead and merge. |
Matrix indices are usually defined so that (1, 1) is the top left entry, not (0, 0). See for example any linear algebra textbook or wikipedia: https://en.wikipedia.org/wiki/Matrix_(mathematics)#/media/File:Matrix.svg exercism/problem-specifications#1387 Matches Data.Matrix.getElem: https://hackage.haskell.org/package/matrix/docs/Data-Matrix.html#v:getElem
Matrix indices are usually defined so that (1, 1) is the top left entry, not (0, 0). See for example any linear algebra textbook or wikipedia:
Even in programming, this notation is more commonly used in the context of matrices, not 2d arrays, (e.g. in Matlab, Fortran, Julia, ...) than a 0-based matrix notation.
It's less confusing for a student if the canonical definition and notation is used, so this PR changes the
canonical-dataanddescriptionaccordingly.