The Museum of HP Calculators

HP Forum Archive 15

 Questions about the RDM CommandMessage #1 Posted by Palmer O. Hanson, Jr. on 17 July 2005, 10:35 p.m. I was working with the 7x7 Hilbert on my HP-28S and decided that I wanted to work with the 5x5. I placed the 7x7 in level 2, placed {5,5} in level 1, and hit RDM. I didn't get a 5x5 Hilbert. Instead I got the following ``` 1 1/2 1/3 1/4 1/5 1/6 1/7 1/2 1/3 1/4 1/5 1/6 1/7 1/8 1/3 1/4 1/5 1/6 1/7 1/8 1/9 1/4 1/5 1/6 1/7``` Wow! I decided to follow the advice I have often given to others "When all else fails, try reading the instructions." I found that my strange result was due to the way the 28 (and the 49) does a Redimension. Quoting from HP28S Reference Manual: "... Elements taken from array1 preserve the same row order in array2. If array2 is dimensioned to contain fewer elements than array1, excess elements from array1 at the end of the row order are discarded. ..." Once I understood what RDM did I could get from the 7x7 to the 5x5 with the following sequence: 7x7 matrix in level 1 { 5,7} in the display Press RDM - Discards the bottom two rows of the 7x7 Press TRN - Moves the 6th and 7th columns to the 6th and 7th rows {5,5} in the display Press RDM - Discards the 6th and 7th rows, which were the 6th and 7th columns Press TRN I now have a 5x5 matrix using the 5x5 elements from the 7x7 matrix. Of course, when working with symmetric matrices like the Hilberts I do not have to do the final TRN. I have two questions: Is there an easier way to accomplish the desired task? What is an application for the RDM function as mechanized?

 Re: Questions about the RDM CommandMessage #2 Posted by chris dean on 18 July 2005, 12:40 p.m.,in response to message #1 by Palmer O. Hanson, Jr. Palmer Surely it would have been easier to generate the new Hilbert matrix using a(i, j) = 1 / (i + j - 1) but this spoils the fun/challenge, doesn't it? I would imagine most people would only use it to increase the size of matrices but they have covered themselves for the reduction process. The algorithm you have used to create the 5x5 appears correct mathematically. Chris

 Re: Questions about the RDM CommandMessage #3 Posted by Palmer O. Hanson, Jr. on 18 July 2005, 10:00 p.m.,in response to message #2 by chris dean When I try to go the other way, say from a 5x5 to a 7x7, by placing the 5x5 in level 2, placing {7,7} in level 1 and pressing RDM I get ``` 1 1/2 1/3 1/4 1/5 1/2 1/3 1/4 1/5 1/6 1/3 1/4 1/5 1/6 1/7 1/4 1/5 1/6 1/7 1/8 1/5 1/6 1/7 1/8 1/9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0``` Double Wow! But, again, reading the manual explaiins what happened: "...If array2 is dimensioned to contain more elements than array1, the additional elements in array2 at the end of the row order are filled with zeroes ..." You are correct in surmising that my interest in this goes beyond finding an easy way to change the dimensions of Hilbert matrices using the HP-28S. One of my interests is in collecting calculators, and I am particularly interested in those machines which exhibit characteristics of which I would say "Why in the world did the manufacturer do it that way?" An obvious example is "Why did TI make the TI-59 with a multiply that was not commutative?" The Dimension command (dim) in machines such as the TI-83+ and TI-85 does redimensioning as I would expect. The RDM command in machines such as the HP-28S and HP-49G doesn't. So I am asking "Does anyone know of an application where the RDM mechanization makes sense?"

 Re: Questions about the RDM CommandMessage #4 Posted by chris dean on 19 July 2005, 6:10 a.m.,in response to message #3 by Palmer O. Hanson, Jr. I cannot think why it is done like this. The algorithm seems to be very naive.

 Re: Questions about the RDM CommandMessage #5 Posted by Thomas Okken on 19 July 2005, 6:55 a.m.,in response to message #3 by Palmer O. Hanson, Jr. It makes sense only from an implementation standpoint. Bear in mind that internally, a matrix is stored as a one-dimensional array; depending on the platform or programming language you're using, that array can be organized in "row-major" or "column-major" order. For example, the matrix ``` 1 2 3 1 4 9``` Would be stored as [ 1 2 3 1 4 9 ] in row-major order, or as [ 1 1 2 4 3 9 ] in column-major order. The HP-28 and 48 series, and the HP-42S, store matrices in row-major order. The behavior of the RDM function (DIM on the 42S) that you describe is caused by the fact that these machines only resize the array, but don't make any effort to keep matrix elements at the same row/column positions. - Thomas

 Re: Questions about the RDM CommandMessage #6 Posted by Chris Dean on 19 July 2005, 1:33 p.m.,in response to message #5 by Thomas Okken I think the conclusion is that RDM is great for 1 dimensional arrays otherwise use with care.

Go back to the main exhibit hall