divide.md (1251B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function divide 4 5 Divide two values, `x / y`. 6 To divide matrices, `x` is multiplied with the inverse of `y`: `x * inv(y)`. 7 8 9 ## Syntax 10 11 ```js 12 math.divide(x, y) 13 ``` 14 15 ### Parameters 16 17 Parameter | Type | Description 18 --------- | ---- | ----------- 19 `x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Numerator 20 `y` | number | BigNumber | Fraction | Complex | Array | Matrix | Denominator 21 22 ### Returns 23 24 Type | Description 25 ---- | ----------- 26 number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Quotient, `x / y` 27 28 29 ### Throws 30 31 Type | Description 32 ---- | ----------- 33 34 35 ## Examples 36 37 ```js 38 math.divide(2, 3) // returns number 0.6666666666666666 39 40 const a = math.complex(5, 14) 41 const b = math.complex(4, 1) 42 math.divide(a, b) // returns Complex 2 + 3i 43 44 const c = [[7, -6], [13, -4]] 45 const d = [[1, 2], [4, 3]] 46 math.divide(c, d) // returns Array [[-9, 4], [-11, 6]] 47 48 const e = math.unit('18 km') 49 math.divide(e, 4.5) // returns Unit 4 km 50 ``` 51 52 53 ## See also 54 55 [multiply](multiply.md)