Mathematica eigensystem incorrect?

  • Context: Mathematica 
  • Thread starter Thread starter thoughtgaze
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around the computation of eigenvalues and eigenvectors of a 4x4 matrix using Mathematica, specifically addressing an issue where the expected equality check between the matrix-vector product and the eigenvalue-scaled eigenvector returns false. Participants explore potential reasons for this discrepancy and suggest alternative methods for verification.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant reports an issue with verifying the eigenvalue and eigenvector relationship using Mathematica, noting that the command returns false instead of true.
  • Another participant suggests that Mathematica may not recognize equivalences in complex expressions and recommends using Simplify or FullSimplify to check the equality.
  • A later reply confirms that the suggested simplification works to resolve the issue.
  • Additional comments propose that using TrueQ may not be necessary in all contexts and suggest an alternative method for checking eigenvalue and eigenvector relationships by constructing a matrix from the eigenvalues and eigenvectors.
  • One participant questions whether the suggested alternative method is computationally easier, indicating an awareness of potential performance issues with symbolic simplifications.

Areas of Agreement / Disagreement

Participants generally agree on the limitations of Mathematica in recognizing complex equivalences and the utility of simplification methods. However, there is no consensus on the best approach to verify the eigenvalue and eigenvector relationship, as different methods are proposed and discussed.

Contextual Notes

Participants express uncertainty regarding the computational efficiency of different methods and the implications of using TrueQ in various contexts. The discussion does not resolve the underlying issue of the initial false result.

thoughtgaze
Messages
74
Reaction score
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
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]
 
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.
 
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.
 
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 10 ·
Replies
10
Views
13K
  • · Replies 2 ·
Replies
2
Views
4K