Department of Mathematics

 

Math 312 - Applied Mathematics: Social Sciences
Spring 2006


Be careful when interpreting the results of numerical calculations.

There are many pitfalls to be aware of when doing numerical computations on a computer. Here is one example of a common occurrence. The matrix is
A =
0.90.10.1
00.90
0.100.9
The exact eigenvalues are 1, 0.9 and 0.8, with eigenvectors (1,0,1), (0,1,-1), and (-1,0,1), respectively (written as rows for convenience). Let's check this with Scilab.
-->A = [0.9 0.1 0.1; 0 0.9 0; 0.1 0 0.9]
 A  =
 
    0.9    0.1    0.1  
    0.     0.9    0.   
    0.1    0.     0.9  
-->[V,D] = spec(A)
 D  =
 
    1.    0      0    
    0     0.8    0    
    0     0      0.9  
 V  =
 
    0.7071068  - 0.7071068    2.338E-18  
    0            0            0.7071068  
    0.7071068    0.7071068  - 0.7071068  
-->
The last column of V should be the eigenvector associated with the eigenvalue 0.9. The top of this column is supposed to be zero, but instead it is 2.338E-18 (i.e. 2.338 x 10-18). This error is because Scilab does its calculations with finite precision. Errors like this are inevitable when doing "floating point" or finite precision calculations with software such as Scilab or Matlab. If you see a result like this, you should consider the possiblity that the true answer is zero.