Mathematica eigensystem incorrect?

  • Mathematica
  • Thread starter thoughtgaze
  • Start date
  • Tags
    Mathematica
In summary: Yes, using a simple subtraction and checking if the result is all zeros is less computationally intensive than using the TrueQ function. It's a more direct and efficient way of checking if two expressions are equivalent.
  • #1
thoughtgaze
74
0
I'm trying to compute the eigenvalues and eigenvectors of a 4x4 matrix using mathematica.
The problem comes when I try to check the values using the commands:

{vals, vecs} = Eigensystem[m]

TrueQ[m.vecs[[1]] == vals[[1]] vecs[[1]]]

Which should return "True"; instead it returns "False"

I tested a different matrix and it returns true. So I'm not sure what to think about that. I would try it by hand, and might end up doing so, but I'm pressed for time and the calculation looks like it could get pretty hairy since the matrix is necessarily in symbolic form. Any help is appreciated. Thanks.
 
Physics news on Phys.org
  • #2
Mathematica isn't always capable of recognizing that two expressions are equivalent if they are sufficiently complicated. Try:

TrueQ[m.vecs[[1]] == vals[[1]] vecs[[1]]//Simplify]

or

TrueQ[m.vecs[[1]] == vals[[1]] vecs[[1]]//FullSimplify]
 
  • #3
phyzguy said:
Mathematica isn't always capable of recognizing that two expressions are equivalent if they are sufficiently complicated. Try:

TrueQ[m.vecs[[1]] == vals[[1]] vecs[[1]]//Simplify]

or

TrueQ[m.vecs[[1]] == vals[[1]] vecs[[1]]//FullSimplify]

Thanks! This works.
 
  • #4
Just a couple of comments:

1) You probably shouldn't use TrueQ unless it's in the logic of some procedure where you need a definite True/False answer.

2) It's easier to test for a-b==0 than a==b

So I would write something like:

m = RandomReal[{0, 1}, {4, 4}]
{vals, vecs} = Eigensystem[m]
Table[(m - vals[] IdentityMatrix[4]).vecs[], {i, 1, 4}] // Chop

and check that the result is all zeros.
 
  • #5
Simon_Tyler said:
Just a couple of comments:

m = RandomReal[{0, 1}, {4, 4}]
{vals, vecs} = Eigensystem[m]
Table[(m - vals[] IdentityMatrix[4]).vecs[], {i, 1, 4}] // Chop



I see, and by easier I assume you mean easier on the cpu? I understand that simplifying can take some time for complicated symbolic expressions.
 

1. What is the Mathematica eigensystem incorrect error?

The Mathematica eigensystem incorrect error is an error message that appears when trying to compute the eigensystem of a matrix in Mathematica. It indicates that there was an issue with the calculation and the resulting eigenvectors and eigenvalues may not be accurate.

2. Why does the Mathematica eigensystem incorrect error occur?

The error can occur due to a number of reasons, such as incorrect syntax, numerical precision issues, or a bug in the Mathematica software. It can also occur if the matrix is not a square matrix or if it is not diagonalizable.

3. How can I fix the Mathematica eigensystem incorrect error?

To fix the error, you can try checking your syntax to make sure it is correct. You can also try increasing the numerical precision in your calculation or using a different method for computing eigensystems. If the error persists, you may need to consult the Mathematica documentation or contact technical support.

4. Are there any alternative methods for computing eigensystems in Mathematica?

Yes, there are several other built-in functions in Mathematica that can be used for computing eigensystems, such as Eigensystem, EigensystemSolve, and Eigenvalues. You can also write your own custom code or use third-party packages for more advanced calculations.

5. How can I prevent the Mathematica eigensystem incorrect error in the future?

To prevent the error, make sure to double-check your syntax and inputs before running the calculation. It is also helpful to have a basic understanding of the underlying mathematics and algorithms used in computing eigensystems. Additionally, regularly updating your Mathematica software can help prevent any potential bugs or issues.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
248
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
8K
  • Calculus and Beyond Homework Help
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
12K
Back
Top