Hi Jos,
Thanks for providing such a useful math library for JS. I'm considering MathJS for a current project, and would like some guidance retrieving rows and columns from a Matrix object. Let's say I have a matrix:
var my_matrix = math.matrix(
[
[ 0.50, 0.25, 0.00],
[ 0.25, 0.50, 1.00]
]
);
And, now I want to retrieve the last column as a 1-D array. After trying various approaches, I came up with this:
var super_special_column = math.flatten(
my_matrix.subset(
math.index([0, 2], 2)
)
).toArray();
Admittedly, I may be spoiled from Python's NumPy syntax, but this seems like a lot of work. Is this the easiest/best way to access members of a Matrix in MathJS?
Thanks again,
Scott
Hi Jos,
Thanks for providing such a useful math library for JS. I'm considering MathJS for a current project, and would like some guidance retrieving rows and columns from a Matrix object. Let's say I have a matrix:
And, now I want to retrieve the last column as a 1-D array. After trying various approaches, I came up with this:
Admittedly, I may be spoiled from Python's NumPy syntax, but this seems like a lot of work. Is this the easiest/best way to access members of a Matrix in MathJS?
Thanks again,
Scott