Selasa, 02 September 2014

Mencari Nilai eigen value dan eigen vektor

Untuk mencari eigen, kita dapat menggunakan pustaka JAMA seperti berikut

       

import jama.EigenvalueDecomposition;
import jama.Matrix;

/**
 *
 * @author www.softscients.web.id
 */
public class DemoJAMA {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        double [][] mat = new double[][]{
            {1, 0, 0, 0, 0},
            {1, 0,1, 1, 1},
            {1, 1, 1, 1, 0},
            {1, 1, 1, 1, 0},
            {1, 1, 1, 0, 0},
            {1, 1, 1, 0, 0}
        };
        Matrix matrix = new Matrix(mat);
        //cari eigen value dan eigen 
        EigenvalueDecomposition eig = matrix.eig();
        //eigen value
        double [][] eigenValue = eig.getD().getArrayCopy();
        //egien vektor
        double [][]eigenVektor = eig.getV().getArrayCopy();
        
        
    }
}

       
 
Posting Komentar