56 lines
1.2 KiB
Markdown
56 lines
1.2 KiB
Markdown
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
||
|
|
||
|
# Function divide
|
||
|
|
||
|
Divide two values, `x / y`.
|
||
|
To divide matrices, `x` is multiplied with the inverse of `y`: `x * inv(y)`.
|
||
|
|
||
|
|
||
|
## Syntax
|
||
|
|
||
|
```js
|
||
|
math.divide(x, y)
|
||
|
```
|
||
|
|
||
|
### Parameters
|
||
|
|
||
|
Parameter | Type | Description
|
||
|
--------- | ---- | -----------
|
||
|
`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Numerator
|
||
|
`y` | number | BigNumber | Fraction | Complex | Array | Matrix | Denominator
|
||
|
|
||
|
### Returns
|
||
|
|
||
|
Type | Description
|
||
|
---- | -----------
|
||
|
number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Quotient, `x / y`
|
||
|
|
||
|
|
||
|
### Throws
|
||
|
|
||
|
Type | Description
|
||
|
---- | -----------
|
||
|
|
||
|
|
||
|
## Examples
|
||
|
|
||
|
```js
|
||
|
math.divide(2, 3) // returns number 0.6666666666666666
|
||
|
|
||
|
const a = math.complex(5, 14)
|
||
|
const b = math.complex(4, 1)
|
||
|
math.divide(a, b) // returns Complex 2 + 3i
|
||
|
|
||
|
const c = [[7, -6], [13, -4]]
|
||
|
const d = [[1, 2], [4, 3]]
|
||
|
math.divide(c, d) // returns Array [[-9, 4], [-11, 6]]
|
||
|
|
||
|
const e = math.unit('18 km')
|
||
|
math.divide(e, 4.5) // returns Unit 4 km
|
||
|
```
|
||
|
|
||
|
|
||
|
## See also
|
||
|
|
||
|
[multiply](multiply.md)
|