# EIG

## Purpose:

Computes eigenvalues and eigenvectors of a square matrix.

## Syntax:

EIG(a, "opt")

(v, d) = EIG(a, "opt")

 a - A square matrix "opt" - Optional. A string, "nobalance" to prevent the preliminary matrix balancing step.

## Alternate Syntax:

(v, d) = EIG(a, b)

 a - A square matrix b - A square matrix with the same dimensions as a.

## Returns:

EIG(a, "opt") returns the eigenvalues as a single column series with as many rows as a.

(v, d) = EIG(a) returns both the eigenvector array and the eigenvalues as the diagonal of an array such that a *^ v == v *^ d.

(v, d) = EIG(a, "nobalance") computes the eigenvector array and eigenvalues without performing the preliminary balancing step.

(v, d) = EIG(a, b) returns both the generalized eigenvector array and eigenvalues as the diagonal of an array such that a *^ v == b *^ v *^ d.

## Example:

a = {{1, 3, 4},

{5, 6, 7},

{8, 9, 12}}

d = eig(a)

d == {19.964160, -1.473921, 0.509760}

## Example:

a = {{1, 3, 4},

{5, 6, 7},

{8, 9, 12}}

(v, d) = eig(a)

v == {{-0.253874, -0.896277,  0.046508},

{-0.504564,  0.270278, -0.801862},

{-0.825205,  0.351621,  0.595697}}

d == {{19.964160,  0.000000, 0.000000},

{ 0.000000, -1.473921, 0.000000},

{ 0.000000,  0.000000, 0.509760}}

a *^ v == v *^ d ==

{{ -5.068385,  1.321041,  0.023708},

{-10.073188, -0.398369, -0.408757},

{-16.474527, -0.518261,  0.303662}}

## Example:

a = {{1, 4, 7},

{2, 5, 8},

{3, 6, 0}}

b = {{1,  9, 4},

{1, 17, 4},

{9,  1, 1}}

(v, d) = eig(a, b)

v == {{-1.000000, -1.000000,  0.110457},

{ 0.670248, -0.299271, -0.076905},

{-0.304598,  0.056988, -1.000000}}

d == {{-0.118305, 0.000000, 0.000000},

{ 0.000000, 0.518879, 0.000000},

{ 0.000000, 0.000000, 1.570855}}

a *^ v == b *^ v *^ d == {{-0.451197, -1.798168, -7.197162},

{-1.085547, -3.040451, -8.163610},

{ 1.021488, -4.795626, -0.130058}}

## Remarks:

For a square matrix A, the scalar λ is an eigenvalue of A if there exists a non-zero vector v such that: Vector v is called a right eigenvector of A corresponding to λ.  This relation can be written as: where I is the NxN identity matrix. A - λI cannot be invertible because: but v must be non-zero. Thus, the determinant of A - λI must be 0. is called the characteristic polynomial of A. The roots of the characteristic polynomial A are the eigenvalues of A.

For (v, d) = eig(a), each column of v is an eigenvector and each main diagonal member of d is a eigenvalue where the nth entry of the diagonal of the eigenvalue array d corresponds to the eigenvector in column n of v.

EIG first performs a balancing step where the rows and columns are transformed to have root mean squares as close as possible while leaving the eigenvalues and eigenvectors unchanged. In most cases, this improves accuracy, but in some cases it does not. EIG(a, "nobalance") can be used to bypass the balancing step. See BALANCE for further details.

For NxN matrices A and B, the generalized eigenvalues and corresponding right eigenvectors satisfy: For non-singular B, the generalized eigenvalue problem reduces to: See DADiSP/MatrixXL to significantly optimize EIG.

*^ (Matrix Multiply)

BALANCE

CHOLESKY

DIAGONAL

EIGVAL

EIGVEC

MMULT

NBEIGVAL

NBEIGVEC

POLY

POLYROOT