Example: Eigensystem Analysis
The eigenvalues and eigenvectors of a matrix are computed.
using System;
using Imsl.Math;
public class EigenEx1
{
public static void Main(String[] args)
{
double[,] a = {
{8, - 1, - 5},
{- 4, 4, - 2},
{18, - 5, - 7}
};
Eigen eigen = new Eigen(a);
new PrintMatrix("Eigenvalues").SetPageWidth(80).Print(eigen.GetValues());
new PrintMatrix("Eigenvectors").SetPageWidth(80).Print(eigen.GetVectors());
}
}
Output
Eigenvalues
0
0 2+4i
1 2-4i
2 0.999999999999997
Eigenvectors
0
0 0.316227766016838-0.316227766016838i
1 0.632455532033676
2 1.66533453693773E-16-0.632455532033676i
1
0 0.316227766016838+0.316227766016838i
1 0.632455532033676
2 1.66533453693773E-16+0.632455532033676i
2
0 0.408248290463863
1 0.816496580927725
2 0.408248290463864
Link to C# source.