It looks like a too basic job. However, I can't do it.
I added math.js to my HTML code
<script src="js/math.min.js"></script>
I define a matrix in firefox console:
var M = math.matrix([[1,0,0,4],[0,1,0,2],[0,5,1,9],[11,2,3,1]]);
So far everything is good.
M
Object { _data: Array[4], _size: Array[2], _datatype: undefined }
Now, I want to access a single element of the matrix:
M.index(1,2)
And I get an error
TypeError: M.index is not a function
It looks like you need to use math.index.
M.subset(math.index(1, 2));
But the preferred method, as pointed out by it's author, is using .get.
M.get([1, 2]);
As of the time of this writing, this feature is preferred but documentation is still catching up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With