This program determines the eigenvalues of a real number matrix.
Theory
Multiplying a vector with a square matrix, usually changes both the magnitude (scale) and the direction of the vector. In the special case where it changes only the magnitude of the vector and leaves the direction unchanged (or switches the vector to the opposite direction), that vector is called an eigenvector of that matrix.
When multiplied by a matrix, each eigenvector of that matrix changes its magnitude by a factor, called the eigenvalue corresponding to that eigenvector. In other words: vector x is called an eigenvector of the matrix A with eigenvalue λ if the following equation holds [5]
A.x = λ.x
The eigenvalues of A are precisely the solutions λ to the equation det(A – λ.x) = 0. Here det() is the determinant of matrix formed by A – λ.I in which I is a n×n identity matrix. This equation is called the characteristic equation of A.
For a more detailed description including complex eigenvalues, refer to my article “Complex Eigenvalues for HP-41cv/cx”
Method
The program uses the iterative power method to determine the largest eigenvalue. This value is removed from the matrix using the deflation method of Hotelling [1]. The remaining eigenvalues are determined in a similar way. Note that accumulation of rounding errors will affect the accuracy of successive eigenvalues.
The power method is an iterative method for approximating eigenvalues. This method is perhaps not the most respected method, and can only be used when:
- There are no two identical eigenvalues.
- The start vector is not the null vector.
- The matrix does not contain complex eigenvalues. (The method will typically work well with a strongly dominated diagonal).
If desired, the eigenvectors can be calculated from the original matrix A. (The deflation method spoils the eigenvector, but not the eigenvalue.)
Examples
- Matrix A
keystrokes
display FIX 3 XEQ “EW” DIM? 2 R/S INV.MATRIX: 1:1=0.000? 8 R/S 1:2=0.000? 4 R/S 2:1=0.000? 3 R/S 2:2=0.000? 6 R/S INV.STARTV.: 1:1=0.000? 1 R/S 2:1=0.000? 1 R/S EPS=0.001? R/S 10.500 : 10.605 EW=10.606 R/S INV.STARTV.: 1:1=0.838? 1 R/S 2:1=0.546? 1 R/S EPS=0.001? R/S -0.230 3.393 3.394 EW=3.394 R/S EINDE The computed eigenvalues 10.606 and 3.394 can be verified through:

This is also verified through the characteristic polynomial. The eigenvalues of A are precisely the solutions λ to the equation listed below with I is the n×n identify matrix.

Therefore:

The solutions to this equation are the eigenvalues λi.
The JavaScript calculator “Eigenwerte und Eigenvektoren berechnen” provides another verification [7].
Listing
- Requires
- X-Functions module on the HP-41cv
- Advantage ROM
- Available as
- source code
- raw code for the V41 emulator
- bar code for the HP Wand (HP82153A)
- Size
- 39 registers
- Registers:
- alfa, X, Y, Z, T, L
- R00: epsilon
- R01: loop counter
- R02: eigenvalue
- Long jumps:
- 41
- 95
; /---------------------------------------------------------------------\ ; | E i g e n v a l u e s | ; | | ; | for the HP-41 | ; \---------------------------------------------------------------------/ ; ; 1.00 ; Coert Vonk ; ; http://www.coertvonk.com/technology/hp41/eigenvalues-4606 01 LBL "EW" 02 E-4 ; default eps 03 STO 00 04 CF 08 05 "DIM ?" ; invoer dimensie 06 PROMPT 07 ABS 08 INT 09 STO 01 10 ENTER^ 11 ENTER^ 12 E3 13 / 14 + 15 "INP. MATRIX:" 16 AVIEW 17 "B" 18 XROM 22,29 ; MATDIM: creeer B-matrix 19 "A" 20 XROM 22,29 ; MATDIM: creer A-matrix 21 XROM 22,61 ; MEDIT: invoer A-matrix 22 LBL 00 23 "A" 24 XROM 22,18 ; DIM? 25 INT 26 "INP. STARTV.:" 27 AVIEW 28 "W" ; creer W-vector 29 XROM 22,29 ; MATDIM 30 "V" ; creer V-vector 31 XROM 22,29 ; MATDIM 32 XROM 22,61 ; MEDIT: invoer V-vector 33 XROM 22,19 ; FNRM 34 "STARTV. ERR" 35 X=0? 36 AVIEW 37 X=0? 38 PSE ; als startvector 39 X=0? ; de nulvector is 40 GTO 00 ; dan opnieuw 41 XEQ 03 42 RCL 00 43 "EPS=" 44 ARCL X 45 >"?" 46 PROMPT ; invoer epsilon 47 STO 00 48 LBL 01 49 "W" 50 XROM 22,57 ; SUM 51 XROM 22,18 ; DIM? 52 INT 53 / 54 VIEW X ; tussenresultaat v/d e.g. laten zien 55 STO 02 56 RCL 00 57 XROM 22,33 ; MIN 58 + 59 XROM 22,30 ; MAX 60 X<=Y? ; test of er aan de nauwkeurigheid eps word voldaan 61 GTO 00 ; zo ja, spring 62 XEQ 03 ; zo nee, ga verder 63 GTO 01 ; toon de gevonden e.w. 64 LBL 00 65 RCL 02 66 "EV=" 67 ARCL X 68 PROMPT 69 DSE 01 ; alle ew nog niet gevonden? 70 GTO 04 ; dan spring naar 04 71 "V" 72 PURFL ; maak de extended-memory weer schoon 73 "W" 74 PURFL 75 "A" 76 PURFL 77 "B" 78 PURFL 79 "EINDE" ; we're done 80 PROMPT 81 GTO E ; zeef de gevonden eigenwaarde uit de laatst gebruikte matrix (A) 82 LBL 04 83 E 84 "X,V,W" 85 XROM 22,25 ; MAT* 86 "W" 87 XROM 22,59 ; TRNPS 88 "V,W,B" 89 XROM 22,24 ; M*M 90 RCL 02 91 "X,B" 92 XROM 22,25 ; MAT* 93 "A,B,A" 94 XROM 22,27 ; MAT- 95 GTO 00 ; voer een iteratie slag uit volgens de powermethode ; zodat v:=A*v en w:=e.w. vector 96 LBL 03 97 "A,V,W" 98 XROM 22,24 ; M*M 99 "W,V" 100 XROM 22,28 ; MAT/ 101 1.001 102 XROM 22,18 ; DIM? 103 RCL Y 104 "V,W" 105 XROM 22,49 ; MSWAP 106 "V" 107 XROM 22,19 ; FNRM 108 1/X 109 "X,V" 110 XROM 22,25 ; MAT* 111 RTN 112 END
References
| [1] | Eigenwaarden Coert Vonk, 27 September 1986 HP User News, SEP86 N9, blz. 48-50 |
|
| [2] | Matrixrekenen Dictaat Lineaire Algebra, blz. 51 e.v. Ir. A. van der Knaap HTS Dordrecht, the Netherlands |
|
| [3] | Wiskunde voor het HBO Deel 2, blz. 153 e.v. R. van Asselt ISBN 90 11 008480 |
|
| [4] | Dictaat Lineaire Algebra 4e druk, blz. 152 ev. G. W. Decnop & H. van Iperen ISBN 90 65 620362 |
|
| [5] | Eigenvalues and eigenvectors Wikipedia http://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors |
|
| [6] | Eigenwerte und Eigenvektoren berechnen Arndt Brünner http://www.arndt-bruenner.de/mathe/scripts/engl_eigenwert2.htm |
