Post Reply 
41CL Quiz: Determinant of 30x30 anti-Identity matrix
06-05-2018, 07:42 AM (This post was last modified: 06-05-2018 07:52 AM by Ángel Martin.)
Post: #51
RE: 41CL Quiz: Determinant of 30x30 anti-Identity matrix
Yes, I'm listening :-D

in fact I've been busy fixing a few glitches in the MCODE as a result of the beta testing, which this test case has also contributed to...

Thanks for the example, it is indeed an interesting one (but of course it *had* to be given its source ;-). First off, there's a few remarks to be made:
  • The execution times are pretty much independent from the actual element values, as there's no provision in the MCODE for special cases (such as 1 or 0) in the calculations. Therefore the D30 example takes about 11 seconds, same as the 30x30 anti-identity matrix took in the previous example.
  • The accuracy is the same as using the Advantage module. Remember: I didn't write new code - only patched it to allow for CL Y-registers as well as the standard RAM registers or X-Mem registers allowed by the Advantage.

With those two remarks made, here's how I did it.

First, the program used to create the matrices and calculate the determinant:

01 LBL "DDN" - expects n in X-Reg
02 RCL X
03 E3
04 /
05 +
06 "Y" - matrix will use the Y-Registers, starting at Y_001
07 MATDIM
08 1
09 MCON - in the SandMatrix
10 CLX
11 MSIJA
12 2
13 LBL 00
14 1
15 +
16 MSC+
17 SF 25
18 J+
19 FS?C 25
20 GTO 00
21 MDET
22 END

And these are the results:

D(11) = 1,486,442,880.0 - in 1.8 seconds
D(13) = 2.834656472 E11 - in 2.01 seconds
D(30) = 3.311538747 E34 - in about 11 seconds

Not bad again, in fact surprisingly good. Using Gerson's values as the reference, these results are practically as accurate as those obtained using the equivalent formula D(n) = (n+1)!*H(n+1). - which can be easily programmed using the Harmonic function in the SandMath (step #4 in the trivial program below):

01 LBL "DN" - n is expected in X
02 1
03 +
04 HARM
05 LASTX
06 FACT
07 *
08 END

which returns respectively (in just a few milliseconds this time):

D(11) = 1,486,442,880.0
D(13) = 2.834656474 E11
D(30) = 3.311538746 E34

Thanks for the case study, it's helped with the beta testing and adds another interesting problem to the list.

Saludos,
Á.

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 41CL Quiz: Determinant of 30x30 anti-Identity matrix - Ángel Martin - 06-05-2018 07:42 AM



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