Post Reply 
(42S; DM 42) Eigenvalues and eigenvectors of symmetric matrices
06-15-2023, 02:51 PM (This post was last modified: 07-02-2023 02:32 PM by rawi.)
Post: #1
(42S; DM 42) Eigenvalues and eigenvectors of symmetric matrices
User Instructions:
(Optional: Put the starting number of the random number generator in SEED)
Put symmetric matrix in M1.
Run program. The vector of eigenvalues is in M2, matrix of standardized eigenvectors is in M3.

Example:
Matrix:
1.00 -0.36 0.12
-0.36 1.00 0.09
0.12 0.09 1.00
Store matrix in M1 - PI SEED - XEQ EVV
Result:
Eigenvalues:
RCL “M2” -> 1.3613; 1.0521; 0.5866
Eigenvalues are sorted according to absolute size.
Eigenvectors:
RCL “M3” -> eigenvectors are in corresponding columns:
-0.7149 0.1937 0.6719
0.6963 0.2848 0.6587
-0.0638 0.9388 -0.3386

Code:
00 { 186-Byte Prgm }
01 LBL “EVV”
02 RCL “M1”
03 STO “M4”
04 STO “M3”
05 DIM?
06 1E-3
07 /
08 1
09 +
10 STO 01
11 STO 02
12 NEWMAT
13 STO “M2”
14 STO “M5”
15 LBL 00
16 INDEX “M5”
17 RAN
18 STOEL
19 I+
20 ISG 01
21 GTO 00
22 RCL “M5”
23 FNRM
24 STO/ ”M5”
25 LBL 01
26 CF 00
27 RCL “M4”
28 RCL “M5”
29 x
30 STO “M6”
31 RCL “M5”
32 DOT
33 X<0?
34 SF 00
35 RCL “M6”
36 FNRM
37 STO/ ”M6”
38 RCL “M6”
39 STO “M5”
40 R↓
41 RCL 00
42 X<>Y
43 FS? 00
44 +/-
45 STO 00
46 -
47 ABS
48 1E-8
49 X<Y?
50 GTO 01
51 RCL “M5”
52 ENTER
53 TRANS
54 x
55 RCLx 00
56 STO- “M4”
57 RCL 02
58 1
59 INDEX “M2”
60 STOIJ
61 RCL 00
62 STOEL
63 INDEX “M3”
64 R↓
65 X<>Y
66 STOIJ
67 RCL “M5”
68 PUTM
69 ISG 02
70 GTO 00
71 CLST
72 CF 00
73 CLV “M4”
74 CLV “M5”
75 CLV “M6”
76 END

Edit: Slightly shorter version of program
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: