mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
863 B
863 B
Function size
Calculate the size of a matrix or scalar.
Syntax
math.size(x)
Parameters
| Parameter | Type | Description |
|---|---|---|
x |
Boolean | Number | Complex | Unit | String | Array | Matrix | A matrix |
Returns
| Type | Description |
|---|---|
| Array | Matrix | A vector with size of x. |
Examples
var math = mathjs();
math.size(2.3); // returns []
math.size('hello world'); // returns [11]
var A = [[1, 2, 3], [4, 5, 6]];
math.size(A); // returns [2, 3]
math.size(math.range(1,6)); // returns [5]