UNPKG

1.1 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function index
4
5Create an index. An Index can store ranges having start, step, and end
6for multiple dimensions.
7Matrix.get, Matrix.set, and math.subset accept an Index as input.
8
9
10## Syntax
11
12```js
13math.index(range1, range2, ...)
14```
15
16### Where
17
18- A number
19- A string for getting/setting an object property
20- An instance of `Range`
21- A one-dimensional Array or a Matrix with numbers
22
23### Parameters
24
25Parameter | Type | Description
26--------- | ---- | -----------
27`ranges` | ...* | Zero or more ranges or numbers.
28
29### Returns
30
31Type | Description
32---- | -----------
33Index | Returns the created index
34
35
36## Examples
37
38```js
39const b = [1, 2, 3, 4, 5]
40math.subset(b, math.index([1, 2, 3])) // returns [2, 3, 4]
41
42const a = math.matrix([[1, 2], [3, 4]])
43a.subset(math.index(0, 1)) // returns 2
44```
45
46
47## See also
48
49[bignumber](bignumber.md),
50[boolean](boolean.md),
51[complex](complex.md),
52[matrix](matrix.md),
53[number](number.md),
54[string](string.md),
55[unit](unit.md)