(DM42) Matrix exponential
|
08-24-2023, 01:14 PM
Post: #28
|
|||
|
|||
RE: (DM42) Matrix exponential
Hi Gjermund,
adapted mine as well so that the number of expm1 terms could be easily changed. I switched to 6 i.o. 10 squarings though - for the 42S version (where it matters most), that meant two fewer matrix multiplications (6 terms, 6 squarings give the same accuracy as 4 terms, 10 squarings), and for the DM42 it doesn't matter (6 terms and 14 squarings or 10 terms and 10 squarings). And, still all in the stack ;-) (I'd like to make it independent of the calculator's precision, but that proves to be a bit of a challenge, only using the stack ;-) 00 { 98-Byte Prgm } 01▸LBL "E↑M-I" 02 ENTER 03 FNRM 04 LN 05 2 06 LN 07 ÷ 08 6 09 + 10 IP 11 X<0? 12 CLX 13 X<>Y 14 2 15 RCL ST Z 16 +/- @ avoids overflow.. 17 Y^X 18 × 19 14 @ 6 for 42S 20 RCL ST Y 21▸LBL 05 @ X := (X/Y+I)*Z, keeping YZT 22 RCL÷ ST Y 23 XEQ 01 24 RCL× ST Z 25 DSE ST Y @ DSE n, skip when n=1 26 DSE ST Y 27 ISG ST Y 28 X=Y? @ aff 29 GTO 05 30 R^ 31 X<>Y 32▸LBL 04 33 ENTER 34 + 35 LASTX 36 STO× ST X 37 + 38 DSE ST Y 39 GTO 04 40 RTN 41▸LBL 01 @ add I 42▸LBL "M+I" 43 EDIT 44 ^ 45▸LBL 02 46 ↓ 47 SIGN 48 X<0? 49 +/- 50 RCL+ ST L 51 → 52 FC? 77 53 GTO 02 54 EXITALL 55 END Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)