mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
45 lines (26 loc) • 816 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
# Function pinv
Calculate the Moore–Penrose inverse of a matrix.
## Syntax
```js
math.pinv(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`.
### Throws
Type | Description
---- | -----------
## Examples
```js
math.pinv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]]
math.pinv([[1, 0], [0, 1], [0, 1]]) // returns [[1, 0, 0], [0, 0.5, 0.5]]
math.pinv(4) // returns 0.25
```
## See also
[inv](inv.md)