Function eigs #
Compute eigenvalue and eigenvector of a real symmetric matrix.
Only applicable to two dimensional symmetric matrices. Uses Jacobi
Algorithm. Matrix containing mixed type (‘number’, ‘bignumber’, ‘fraction’)
of elements are not supported. Input matrix or 2D array should contain all elements
of either ‘number’, ‘bignumber’ or ‘fraction’ type. For ‘number’ and ‘fraction’, the
eigenvalues are of ‘number’ type. For ‘bignumber’ the eigenvalues are of ‘‘bignumber’ type.
Eigenvectors are always of ‘number’ type.
Syntax #
Parameters #
Parameter |
Type |
Description |
x |
Array | Matrix |
Matrix to be diagonalized |
Returns #
Type |
Description |
{values: Array, vectors: Array} | {values: Matrix, vectors: Matrix} |
Object containing eigenvalues (Array or Matrix) and eigenvectors (2D Array/Matrix with eigenvectors as columns). |
Examples #
const H = [[5, 2.3], [2.3, 1]]
const ans = math.eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors as columns]}
const E = ans.values
const U = ans.vectors
math.multiply(H, math.column(U, 0)) // returns math.multiply(E[0], math.column(U, 0))
const UTxHxU = math.multiply(math.transpose(U), H, U) // rotates H to the eigen-representation
E[0] == UTxHxU[0][0] // returns true
See also #
inv