Questions about the RDM Command



#7

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?


#8

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


#9

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?"


#10

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

#11

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


#12

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


Possibly Related Threads...
Thread Author Replies Views Last Post
  [HP-Prime CAS] "Warning, ^ (Command) Is ambiguous on non square matrices"?? CompSystems 1 907 12-07-2013, 07:15 PM
Last Post: CompSystems
  HP Prime - most favorite command bluesun08 2 739 11-12-2013, 11:29 AM
Last Post: bluesun08
  hp prime - command syntax bluesun08 6 1,120 11-10-2013, 11:57 AM
Last Post: bluesun08
  HP PRIME: command to read the SERIAL ? Joseph Ec 9 2,478 11-01-2013, 12:43 AM
Last Post: Joe Horn
  Connectivty Kit for HP Prime needs an "Import Program" Command Eddie W. Shore 3 857 10-23-2013, 03:37 PM
Last Post: Eddie W. Shore
  HP Prime MOUSE command SanS 3 792 10-15-2013, 12:15 PM
Last Post: Han
  [HP-Prime] randPoly command CompSystems 0 451 09-26-2013, 08:49 AM
Last Post: CompSystems
  [HP-Prime xCAS] BUG: string command =( CompSystems 6 946 09-10-2013, 06:38 PM
Last Post: CompSystems
  [HP_Prime] definition of functions, APPLY command and BUGs CompSystems 1 564 09-05-2013, 03:59 PM
Last Post: CompSystems
  [HP-Prime] Request: New command for CAS (EvalStep) CompSystems 4 758 09-04-2013, 09:33 AM
Last Post: Eddie W. Shore

Forum Jump: