Skip to content
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

Documentation of subset is misleading #2325

Closed
m93a opened this issue Sep 23, 2021 · 3 comments · Fixed by #2446
Closed

Documentation of subset is misleading #2325

m93a opened this issue Sep 23, 2021 · 3 comments · Fixed by #2446

Comments

@m93a
Copy link
Collaborator

m93a commented Sep 23, 2021

In the documentation for the subset function, it says that:

Parameter index — An index containing ranges for each dimension

That is quite misleading, because the function expects a list of indices, not a range. Compare:

import { subset, index, range } from 'mathjs'
const M = [[1],[2],[3]]

subset(M, index([0,2],0)) // → [[1],[3]]
subset(M, index([0,1,2],0)) // → [[1],[2],[3]]
subset(M, index(range(0,2),0)) // → [[1],[2],[3]]
@arulandu
Copy link

@m93a Can I work on this issue as my first contribution to this repository?

@josdejong
Copy link
Owner

Thanks for your offer @Claeb101 , would be great if you could improve the docs 👍

gwhitney added a commit to gwhitney/mathjs that referenced this issue Feb 23, 2022
  Incorporates (and supersedes) josdejong#2326 and the discussion therein.
  Resolves josdejong#2325.
josdejong added a commit that referenced this issue Mar 1, 2022
Incorporates (and supersedes) #2326 and the discussion therein.
  Resolves #2325.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
@josdejong
Copy link
Owner

Docs are improved in v10.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants