mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
40 lines
734 B
Markdown
40 lines
734 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
# Function inv
|
|
|
|
Calculate the inverse of a square matrix.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.inv(x)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | number | Complex | Array | Matrix | Matrix to be inversed
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | Complex | Array | Matrix | The inverse of `x`.
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.inv([[1, 2], [3, 4]]); // returns [[-2, 1], [1.5, -0.5]]
|
|
math.inv(4); // returns 0.25
|
|
1 / 4; // returns 0.25
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[det](det.md),
|
|
[transpose](transpose.md)
|