Post Reply 
[VA] My 2024's very first little teaser
01-30-2024, 08:54 PM
Post: #18
RE: [VA] My 2024's very first little teaser
  
Hi, PeterP, J-F Garnier, Maximilian Hohmann (and you lurkers,)

A few comments re your recent posts to this thread, in order:

PeterP Wrote:Wonderful! Thank you for sharing. I especially liked the clever use of the read and input statements to fill the matrix.

You're welcome, PeterP, and thanks for your appreciation. I always strive to show new techniques to help people better use their calcs so I'm glad you found the read/input tricks useful.


J-F Garnier Wrote:Great solutions, Valentin ! Your "elegant" solution is astonish, I'm not sure I would have thought about this efficient way to fill the 7x7 matrix. It is however specific to the 71B BASIC and will not work with other HP BASIC versions such as the HP-75C, and all in all I prefer your 2nd version, not only shorter but more standard.

Thank you very much, J-F. The reason I specified that people should use the HP-71B and no other models was because my "elegant" solution wouldn't run unchanged in any other model, including the ungainly clunker aka HP-75C.

Anyway, I prefer it vs. my "shorter" solution. By the way, I did try an optimization to the latter consisting in temporarily redimensioning the 7x7 matrix to a 49-element vector, so that the indexing would require just one index instead of two, like this:

   1  OPTION BASE 1 @ DIM M(7,7) @ MAT M=IDN @ DIM M(49)
   2  M(1)=0 @ INPUT M(2),M(43),M(20),M(3),M(29),M(13),M(4),M(36),M(12)
   3  M(26)=M(20) @ M(21)=M(12) @ M(28)=M(13) @ DIM M(7,7) @ DISP DET(M)


but no joy, it's actually 141 bytes long, i.e. 10 bytes longer than the non-redimensioned one. So much for the "optimization". Smile

By the way, I fully expected people to use DOT and DET for the easy teaser, but I'm mildly surprised that no one considered creatively using the HP-71B's Statistics functionality (STAT, ADD, DROP, TOTAL, etc.) though if I'm not wrong the clunker lacks those as well.

He Also Wrote:Regarding the 7x7 matrix, I lately came to the idea that the solution was a single DET applied to a specifically built matrix, [...] Knowing what to look for, it's now quite easy to find it in the literature [...]

Indeed, you just have to google it like this, and the very first link found points to the precise document where the 7x7 matrix I used can be found in page 9:
      [Image: Permanent%2019.jpg]

and a somewhat simpler explanation on how to construct the 7x7 matrix (and the 7x7 matrix itself) can be found here:
Permanent Determinant.
    Note: Symbolically computing the determinant of the 7x7 matrix should give the expression in my OP for the 3x3 symbolic determinant or an equivalent one. Try it !
And He Finally Wrote:As for the low participation, there are probably several reasons, but one may be that the game was restricted to the HP-71B, that is unfortunately not the most popular machine on this forum.

Well, so much for the forum, their loss. Sad


Maximilian Hohmann Wrote:However I learnt that HP-71B BASIC allows the use of variables in DATA statements which is an interesting feature that I completely overlooked so far! Thanks for that.

You're welcome, Maximilian, thanks for your interest and I'm glad you became aware of a new technique, that meets one of my goals here. By the way, DATA statements can hold not just numbers, strings and variables, but whole numeric or string expressions, which will be evaluated upon being accessed by READ statements, e.g.

   10 DATA 7.51E-23,"PARIS",35-LN(X)/LN(2),FNROOT(A,B,FVAR^5+FVAR-X)
   20 DATA X$[1,5]&Y$,FNA(X,Y)-FNB(Y,Z),DET(M)/DET(N)
    Note: In my "elegant" solution, the DATA statements would be 31 bytes shorter (and thus could coalesce into just one, making the solution a 3-liner) if a null item (e.g. 3,5,,7, ...,) could be read into a numeric variable or matrix element as a 0, which would've been trivial to implement at the time, but the HP-71B designers didn't see fit to allow for the possibility and attempting the feat just gives an error.

Regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] My 2024's very first little teaser - Valentin Albillo - 01-30-2024 08:54 PM



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