Skip to content

Conversation

@SaschaMann
Copy link
Contributor

@SaschaMann SaschaMann commented Nov 7, 2018

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:

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-data and description accordingly.

@rpottsoh rpottsoh requested a review from petertseng November 25, 2018 01:39
@petertseng petertseng removed their request for review November 25, 2018 01:39
@rpottsoh
Copy link
Member

rpottsoh commented Nov 25, 2018

@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.

@petertseng
Copy link
Member

it does not matter to me, therefore I have done nothing with this PR

@sshine
Copy link
Contributor

sshine commented Nov 26, 2018

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.

@rpottsoh
Copy link
Member

@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.

@SaschaMann
Copy link
Contributor Author

SaschaMann commented Dec 21, 2018

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)

@rpottsoh
Copy link
Member

Seeing no comments against merging or for more changes I am going to go ahead and merge.

@rpottsoh rpottsoh merged commit 155566f into master Dec 24, 2018
@rpottsoh rpottsoh deleted the smann/matrix-notation branch December 24, 2018 21:19
sshine pushed a commit to exercism/haskell that referenced this pull request Sep 7, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants