HP Forums
Questions about the RDM Command - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Questions about the RDM Command (/thread-76120.html)



Questions about the RDM Command - Palmer O. Hanson, Jr. - 07-17-2005

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 Command - Chris Dean - 07-18-2005

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 Command - Palmer O. Hanson, Jr. - 07-18-2005

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 Command - Chris Dean - 07-19-2005

I cannot think why it is done like this. The algorithm seems to be very naive.




Re: Questions about the RDM Command - Thomas Okken - 07-19-2005

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 Command - Chris Dean - 07-19-2005

I think the conclusion is that RDM is great for 1 dimensional arrays otherwise use with care.