How to implement an array ?
02-19-2016, 09:38 PM (This post was last modified: 02-19-2016 09:39 PM by smp.)
Post: #1
 smp Senior Member Posts: 463 Joined: Jul 2015
How to implement an array ?
I apologize in advance for my newbie question.

I have in mind a project for my HP Prime which will not be too terribly difficult to do, but which will require three one-dimensional arrays. Two of the arrays will have 256 elements in a single row or column, and the third array will have 65536 elements in a single row or column. These arrays will hold integer numbers

I have, once again, been looking at the skimpy information about programming in HP PPL in the HP Prime User Guide, but I do not see anything about creating or using arrays.

Would I have to use matrices? My thinking had been for arrays because I only need storage for integers, and matrices want to hold real or complex numbers, and I didn't want to use up that much more memory when I don't need to.

Thanks very much, in advance, for any advice you may have to offer.

smp
02-19-2016, 10:13 PM
Post: #2
 DrD Senior Member Posts: 1,133 Joined: Feb 2014
RE: How to implement an array ?
It sounds like you might like to use vectors, one dimensional matrices.
For example:

RANDMAT(M1,256,1,99);

Creates a random column vector, containing 256 elements. The elements will be between 1 and 99, and are saved in variable M1.

M1(5) will access the fifth element in the array, for example.
02-20-2016, 12:15 AM
Post: #3
 smp Senior Member Posts: 463 Joined: Jul 2015
RE: How to implement an array ?
(02-19-2016 10:13 PM)DrD Wrote:  It sounds like you might like to use vectors, one dimensional matrices.

Thanks very much, DrD. That's what I thought when I asked about matrices.
Thanks for verifying this for me.

smp
02-20-2016, 05:05 AM (This post was last modified: 02-20-2016 05:06 AM by Carlos295pz.)
Post: #4
 Carlos295pz Senior Member Posts: 365 Joined: Sep 2015
RE: How to implement an array ?
Some more facts about Matrices, Vectors and Lists as replacing Arrays
PPL - Additional Information PART I (Spanish)

Viga C | TD | FB
02-22-2016, 05:59 AM
Post: #5
 cyrille de brĂ©bisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: How to implement an array ?
Hello,

Prime has build in 1d (vectors) and 2d (matrices) objects.
If you need 3D, you can either use lists, or use lists with matrices in them.

remember that you can access sub-elements of a list by doing L(a,b,c) where a is the index in the list and b/c indexes in the list sub-element.

cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
 « Next Oldest | Next Newest »

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