Post Reply 
(42S) Matrix Integer Powers
08-04-2023, 02:45 PM
Post: #2
RE: (42S) Matrix Integer Powers
All in the stack, integrated IDN, and avoiding a multiplication by the unit matrix:

Code:
00 { 66-Byte Prgm }
01▸LBL "MPOW"
02 X≠0?
03 GTO 00
04 ×
05 EDIT
06▸LBL 02
07 SIGN
08 →
09 X=0?
10 I+
11 X=0?
12 GTO 02
13 EXITALL
14 RTN
15▸LBL 00
16 X>0?
17 GTO 00
18 +/-
19 X<>Y
20 INVRT
21 X<>Y
22▸LBL 00
23 SIGN
24 LASTX
25▸LBL 03 @ n R A
26 2
27 ÷
28 ENTER
29 FP
30 X=0?
31 GTO 00
32 R^
33 STO× ST T @ R := R*A;
34 R↓
35 X=Y?
36 GTO 01
37▸LBL 00
38 R^
39 STO× ST X @ A := A*A;
40 R↓
41 -
42 GTO 03
43▸LBL 01
44 X<> ST Z
45 END

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42S) Matrix Integer Powers - Gerald H - 02-15-2015, 07:35 AM
RE: (42S) Matrix Integer Powers - Werner - 08-04-2023 02:45 PM
RE: (42S) Matrix Integer Powers - Gerald H - 08-05-2023, 03:22 PM
RE: (42S) Matrix Integer Powers - Werner - 08-06-2023, 08:02 AM



User(s) browsing this thread: 1 Guest(s)