Matrix/Array 28/48/50 Question



#2

Hello all

Can I dynamically access an array or matrix element by simply accessing it these ways:

matrix/array name[var]

or

matrix/array name[row, col]

Or am I only to use GET and PUT?


Edited: 4 June 2012, 2:41 p.m. after one or more responses were posted


#3

Sadly not. You'll need to use GET or GETI.


#4

Okay. Besides, that does follow the Postfix structure so, no matter. Just a thought.


#5

Quote:
Just a thought.

And not a bad one either! I picked it up in RPL+ where you can use the array syntax you suggest. You also have a choice of 1-based or 0-based indices, and automatic support for circular arrays. (But RPL+ is not available on those HP calcs.)


#6

Well, this is a new one...RPL+. Hmm. Which calcs employ RPL+ ?


#7

So far, RPL+ is only implemented in one iPhone app: ND1 (ND0 is a free version to try out.)

If you visit the forum, you can learn about what other devices are planned to be supported in the future.

If you know RPL and are just curious about what's new: RPL+ for RPL Users

#8

Hello Matt,

I found the following process working for me:

'M(row,column)' EVAL @ to extract a matrix element
N 'M(row, column)' STO @ to store a number N into a matrix element

Instead of EVAL in the first case you can use \->NUM, too.

I've tried this on the HP-49G, 49G+ and 50G.

Hope this helps

Regards

Karl


#9

Hi

I also use this and it works fine (49/50).

Exemple to try :

 { 5 5 } RANM  'Mat' STO         @ Create a 5x5 random matrix and store it

2 'a' STO

'Mat(a,2)' EVAL @ Return the value

99 'Mat(a,2)' STO @ Store 99 in a,2 cell

'Mat(a,2)' EVAL 'Mat(5,5)' STO @ Put value of a,2 in 5,5

IF 'Mat(a,2)==Mat(5,5)' THEN "Equal value " MSGBOX END
Mat @ Show result

It also works with 'vector'

[ 1 2 3 4 5 ] 'Vect' STO

'Vect(3)' EVAL

99 'Vect(5)' STO


Edited: 4 June 2012, 4:59 p.m.

#10

Apologies. I had forgotten about this option.

Know though that it runs almost an order of magnitude slower!

From another discussion elsewhere:

Quote:
<< [1 2 3] -> x << 1. 1000. START 'x(1)' EVAL DROP NEXT >> >>
runs 6.5x slower than
<< [1 2 3] -> x << 1. 1000. START x 1 GET DROP NEXT >> >>

And that's 9x slower if you factor out the time for
<< 1. 1000. START NEXT >>
as one should.

(On Emu-48/HP-49G.)



#11

Not certain which post to post this under. Thanks for all your brilliant methods to accomplish the functionality I needed.


Possibly Related Threads…
Thread Author Replies Views Last Post
  AFTER HP-Prime update, Shift+Matrix CRASHES Joseph Ec 3 2,071 12-06-2013, 11:06 AM
Last Post: Joseph Ec
  HP Prime Matrix TERRIBLE bug and question uklo 19 5,289 11-25-2013, 12:10 PM
Last Post: Mic
  HP Prime: editing a matrix Alberto Candel 6 2,385 11-20-2013, 06:26 PM
Last Post: Helge Gabert
  HP Prime... NOT meant to replace HP48,49,50 ? Chris Pem10 21 5,790 11-18-2013, 03:30 PM
Last Post: Chris Smith
  Absolute Value and Matrix BruceTTT 5 2,168 11-11-2013, 11:52 PM
Last Post: Walter B
  HP Prime: How to use a large array in a program? HP Pioneer 2 1,462 10-27-2013, 03:15 AM
Last Post: steindid
  ANN: A MacOSX Kermit program for HP48/49/50 calculators Paul Onions 2 1,642 09-08-2013, 04:55 AM
Last Post: Paul Onions
  WP-34S Matrix operations with routine-local registers? Tom Grydeland 1 1,215 09-04-2013, 10:46 AM
Last Post: Marcus von Cube, Germany
  Matrix Characteristic Polynomial - Reloaded. Ángel Martin 12 3,551 08-22-2013, 05:33 PM
Last Post: Thomas Klemm
  Matrix Richard Berler 3 1,464 08-18-2013, 06:24 PM
Last Post: Paul Dale

Forum Jump: