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

norm returns a complex number #1237

Closed
harrysarson opened this Issue Sep 4, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@harrysarson
Collaborator

harrysarson commented Sep 4, 2018

http://mathjs.org/docs/reference/functions/norm.html documents math.norm as returning a Number or a BigNumber.

However, the frobenius norm of a matrix containing complex values is a complex number (with imaginary part equal to 0).

math.norm(math.matrix([[math.complex(1, 4)]]), 'fro')
// Object { re: 4.123105625617661, im: 0 }

@harrysarson harrysarson added the bug label Sep 4, 2018

@harrysarson

This comment has been minimized.

Show comment
Hide comment
@harrysarson

harrysarson Sep 4, 2018

Collaborator

Note: unless the matrix is 2D the result is correct.

math.norm(math.complex(1, 4), 'fro')
// 4.123105625617661

math.norm(math.matrix([math.complex(1, 4)]), 'fro')
// 4.123105625617661
Collaborator

harrysarson commented Sep 4, 2018

Note: unless the matrix is 2D the result is correct.

math.norm(math.complex(1, 4), 'fro')
// 4.123105625617661

math.norm(math.matrix([math.complex(1, 4)]), 'fro')
// 4.123105625617661

harrysarson added a commit that referenced this issue Sep 4, 2018

Fix most errors due to assert.strictEquals
Some instances of `strictEquals` are replaced by `deepEquals`.
`toString` has been used to make some string comparisions explicit.
Tests will still fail untill #1236 and #1237 are fixed.

josdejong added a commit that referenced this issue Sep 8, 2018

@josdejong

This comment has been minimized.

Show comment
Hide comment
@josdejong

josdejong Sep 8, 2018

Owner

👍 should be fixed via ba1987f

Owner

josdejong commented Sep 8, 2018

👍 should be fixed via ba1987f

@josdejong josdejong closed this in c5971b3 Sep 8, 2018

@harrysarson

This comment has been minimized.

Show comment
Hide comment
@harrysarson

harrysarson Sep 8, 2018

Collaborator

ba1987f looks ace 👍

Collaborator

harrysarson commented Sep 8, 2018

ba1987f looks ace 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment