Hi,I would like to ask about eigenvalue and eigenvector ,
I manually calculate eigenvalue for this matrix [5,1,-2,2] and the answer are 3 and 4 . However when I run this coding the output give the eigenvalue 1 and 6.
1 2 3 4 5 6
Matrix2f A;
A << 5, 1, -2, 2;
cout << "Here is the matrix A:\n" << A << endl;
SelfAdjointEigenSolver<Matrix2f> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
Are you looking for confirmation of the answers?
Or are you looking for help with coding?
The answers you calculated manually seem to be correct. I confirmed them with another program: Eigenvalue and Eigenvector Calculator ( http://www.akiti.ca/EigR12Solver.html )
The output from this program is
1 2 3 4 5 6 7 8 9 10 11
The eigenvalues follow:
4
3
Error Code: -1
The eigenvector matrix follows:
0.7071067811865475 -0.4472135954999581
-0.7071067811865475 0.8944271909999157
Commercial programs like MATLAB, MathCAD, Maple, etc. would probably confirm these numbers too. However, I am not familiar with the programs posted on the tuxfamily site, so cannot comment about why their results differ.