@@ -156,7 +156,7 @@ Functions that require two or more matrix like arguments that operate elementwis
156156
157157``` js
158158A = math .matrix ([1 , 2 ]) // Matrix, [1, 2]
159- math .add (A , 3 ) // Matrix, [3, 4 ]
159+ math .add (A , 3 ) // Matrix, [4, 5 ]
160160
161161B = math .matrix ([[3 ], [4 ]]) // Matrix, [[3], [4]]
162162math .add (A , B ) // Matrix, [[4, 5], [5, 6]]
@@ -181,31 +181,30 @@ Math.js uses geometric dimensions:
181181- A vector is one-dimensional.
182182- A matrix is two or multidimensional.
183183
184- The size of a matrix can be calculated with the function ` size ` . Function ` size `
185- returns a ` Matrix ` or ` Array ` , depending on the configuration option ` matrix ` .
186- Furthermore, matrices have a function ` size ` as well, which always returns
187- an Array.
184+ The size of a matrix can be calculated with the function ` size ` . This function
185+ returns an ` Array ` , giving the length of its input (` Matrix ` or ` Array ` ) in
186+ each dimension. You can also call ` size() ` as a method on a Matrix.
188187
189188``` js
190189// get the size of a scalar
191- math .size (2.4 ) // Matrix , []
192- math .size (math .complex (3 , 2 )) // Matrix , []
193- math .size (math .unit (' 5.3 mm' )) // Matrix , []
190+ math .size (2.4 ) // Array , []
191+ math .size (math .complex (3 , 2 )) // Array , []
192+ math .size (math .unit (' 5.3 mm' )) // Array , []
194193
195194// get the size of a one-dimensional matrix (a vector) and a string
196195math .size ([0 , 1 , 2 , 3 ]) // Array, [4]
197- math .size (' hello world' ) // Matrix , [11]
196+ math .size (' hello world' ) // Array , [11]
198197
199198// get the size of a two-dimensional matrix
200199const a = [[0 , 1 , 2 , 3 ]] // Array
201200const b = math .matrix ([[0 , 1 , 2 ], [3 , 4 , 5 ]]) // Matrix
202201math .size (a) // Array, [1, 4]
203- math .size (b) // Matrix , [2, 3]
202+ math .size (b) // Array , [2, 3]
204203
205- // matrices have a function size (always returns an Array)
204+ // matrices have a method size
206205b .size () // Array, [2, 3]
207206
208- // get the size of a multi-dimensional matrix
207+ // get the size of a multi-dimensional array
209208const c = [[[0 , 1 , 2 ], [3 , 4 , 5 ]], [[6 , 7 , 8 ], [9 , 10 , 11 ]]]
210209math .size (c) // Array, [2, 2, 3]
211210```
@@ -360,7 +359,7 @@ const m = math.matrix([[1, 2, 3], [4, 5, 6]])
360359| ` math.subset(m, math.index([0, 1], [1, 2])) ` | No change needed | ` [[2, 3], [5, 6]] ` |
361360| ` math.subset(m, math.index(1, [1, 2])) ` | ` math.subset(m, math.index([1], [1, 2])) ` | ` [[5, 6]] ` |
362361| ` math.subset(m, math.index([0, 1], 2)) ` | ` math.subset(m, math.index([0, 1], [2])) ` | ` [[3], [6]] ` |
363- | ` math.subset(m, math.index(1, 2)) ` | No change needed | 6 |
362+ | ` math.subset(m, math.index(1, 2)) ` | No change needed | ` 6 ` |
364363
365364
366365> ** Tip:**
0 commit comments