UNPKG

1.53 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function eigs
4
5Compute eigenvalue and eigenvector of a real symmetric matrix.
6Only applicable to two dimensional symmetric matrices. Uses Jacobi
7Algorithm. Matrix containing mixed type ('number', 'bignumber', 'fraction')
8of elements are not supported. Input matrix or 2D array should contain all elements
9of either 'number', 'bignumber' or 'fraction' type. For 'number' and 'fraction', the
10eigenvalues are of 'number' type. For 'bignumber' the eigenvalues are of ''bignumber' type.
11Eigenvectors are always of 'number' type.
12
13
14## Syntax
15
16```js
17math.eigs(x)
18```
19
20### Parameters
21
22Parameter | Type | Description
23--------- | ---- | -----------
24`x` | Array &#124; Matrix | Matrix to be diagonalized
25
26### Returns
27
28Type | Description
29---- | -----------
30{values: Array, vectors: Array} &#124; {values: Matrix, vectors: Matrix} | Object containing eigenvalues (Array or Matrix) and eigenvectors (2D Array/Matrix with eigenvectors as columns).
31
32
33## Examples
34
35```js
36const H = [[5, 2.3], [2.3, 1]]
37const ans = math.eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors as columns]}
38const E = ans.values
39const U = ans.vectors
40math.multiply(H, math.column(U, 0)) // returns math.multiply(E[0], math.column(U, 0))
41const UTxHxU = math.multiply(math.transpose(U), H, U) // rotates H to the eigen-representation
42E[0] == UTxHxU[0][0] // returns true
43```
44
45
46## See also
47
48[inv](inv.md)