multiply.md (1413B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function multiply 4 5 Multiply two or more values, `x * y`. 6 For matrices, the matrix product is calculated. 7 8 9 ## Syntax 10 11 ```js 12 math.multiply(x, y) 13 math.multiply(x, y, z, ...) 14 ``` 15 16 ### Parameters 17 18 Parameter | Type | Description 19 --------- | ---- | ----------- 20 `x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | First value to multiply 21 `y` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Second value to multiply 22 23 ### Returns 24 25 Type | Description 26 ---- | ----------- 27 number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Multiplication of `x` and `y` 28 29 30 ### Throws 31 32 Type | Description 33 ---- | ----------- 34 35 36 ## Examples 37 38 ```js 39 math.multiply(4, 5.2) // returns number 20.8 40 math.multiply(2, 3, 4) // returns number 24 41 42 const a = math.complex(2, 3) 43 const b = math.complex(4, 1) 44 math.multiply(a, b) // returns Complex 5 + 14i 45 46 const c = [[1, 2], [4, 3]] 47 const d = [[1, 2, 3], [3, -4, 7]] 48 math.multiply(c, d) // returns Array [[7, -6, 17], [13, -4, 33]] 49 50 const e = math.unit('2.1 km') 51 math.multiply(3, e) // returns Unit 6.3 km 52 ``` 53 54 55 ## See also 56 57 [divide](divide.md), 58 [prod](prod.md), 59 [cross](cross.md), 60 [dot](dot.md)