UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

45 lines (27 loc) 841 B
# Function size Calculate the size of a matrix or scalar. ## Syntax ```js math.size(x) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `x` | Boolean &#124; Number &#124; Complex &#124; Unit &#124; String &#124; Array &#124; Matrix | A matrix ### Returns Type | Description ---- | ----------- Array &#124; Matrix | A vector with size of `x`. ## Examples ```js 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] ``` ## See also [resize](resize.md), [squeeze](squeeze.md), [subset](subset.md) <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->