Arrays
02-24-2019, 06:16 PM
Post: #1
 ovenglove Junior Member Posts: 3 Joined: Feb 2019
Arrays
Hi, I've just purchased a prime and am attempting to write some software on it.
I need an array 64 elements long that will store numbers.
In Basic or C I'd just declare one and access the arrays elements quite easily.
Looking at other peoples programs (as the documentation for the prime is poor to say the least) it appears people seem to use lists which require a lot of overheads.

Am I missing something?

Thanks
Iain
02-24-2019, 08:35 PM
Post: #2
 grsbanks Senior Member Posts: 1,068 Joined: Jan 2017
RE: Arrays
You could always use a 64-element matrix.
02-25-2019, 12:32 AM
Post: #3
 derekamos Junior Member Posts: 44 Joined: Jan 2015
RE: Arrays
Hi ovenglove,
I found this older article solved my problems:
'Dynamic Variables' both for text or numerics,
Han also has a later article, that shows similar methods explained slightly differently. Both together make for a great way to get around using the Primes pre-programmed methods.
DA
02-25-2019, 06:21 AM
Post: #4
 cyrille de brĂ©bisson Senior Member Posts: 1,007 Joined: Dec 2013
RE: Arrays
Hello,

If you need to do this in a program, declare a local variable to store a list or a matrix.

Matrix are faster and smaller in size, BUT they can only store numbers. Lists are more versatile.

LOCAL myvar= makelist(2*I, I, 1, 64); // Creates a local variable called myvar which is initialized with a list that contains number "created" by calculating 2*I with I going form 1 to 64

LOCAL myvar2= makemat(2*J, 64); // Creates a local variable called myvar2 which is initialized with a 64 element vector "created" by calculating 2*J with I going form 1 to 64. for matrix, I and J are always the variables, you can not choose them.

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.
02-25-2019, 03:21 PM
Post: #5
 ovenglove Junior Member Posts: 3 Joined: Feb 2019
RE: Arrays
Thanks for the answers folks, I'll give it a go this evening.
I'd figured that the matrix was the best approach for my application as I'm only using numbers.

It's a pity that there's no reference books for the prime like I have for the 48GX, there's lots of info out there but it's quite fragmented and I'd rather read off paper than the screen any day.

Cheers
Iain
02-25-2019, 06:44 PM
Post: #6
 grsbanks Senior Member Posts: 1,068 Joined: Jan 2017
RE: Arrays
That's the way of the world these days, I'm afraid.

Printing costs a lot of money, which is why you're probably reluctant to print the 761-page user guide yourself... But of course you could print the parts you're interested in alone.
02-25-2019, 10:14 PM
Post: #7
 ovenglove Junior Member Posts: 3 Joined: Feb 2019
RE: Arrays
Funnily enough, I have actually printed it today, just need to bind it but it doesn't really go into programming in any great detail. Things have certainly gone downhill since my HP41 and HP48.
What really bugs me though is the fact that we don't even have the option these days of buying printed versions.
The Prime doesn't even come with the quick start guide or a CD now, just a couple of bits of fold out paper junk and a shiny piece of card trying to get you to buy the Prime app for your phone or PC.
02-25-2019, 11:26 PM
Post: #8
 rprosperi Senior Member Posts: 4,167 Joined: Dec 2013
RE: Arrays
(02-25-2019 10:14 PM)ovenglove Wrote:  Funnily enough, I have actually printed it today, just need to bind it but it doesn't really go into programming in any great detail. Things have certainly gone downhill since my HP41 and HP48.

I'll start by completely agreeing that the Prime User Guide could and should be improved, and also kept updated with the always-improving software. However if the Prime UG were to cover every function it has, in as much detail as the 41 UG did, including the tutorial approach to explaining how to use each command, it would be several thousand pages long, and even more difficult to use than it already is.

Even as early as the 48SX (but more so with the GX) the HP manuals had ceased to be instructional and thorough, beginning the changeover to the almost pure reference style that most of them are today. General operation principles are explained, with the goal (and hope) that the user can extrapolate how those principles apply when using the huge set of built-in commands and functions.

Still, the split personality of Home vs. CAS mode, and the persnickety (made worse by not being consistent) details one must know to use both of those is a huge obstacle to both learn and use Prime and IMHO, this is the area the UG is least helpful. Further, using both these modes together is clearly not the domain of 99% of students (supposedly, the target market), and the weird bending and twisting of command syntax to allow this does far more harm then help.

As for programming, there is basic information already included but without context, it's not too helpful. I think it would benefit to include a few thoroughly commented, non-trivial programs (each with a separate focus such as graphics (a game using touch screen and keybaord), symbolic math (showing how to use CAS programs), matrix manipulation (Eigenvectors/Values), etc.) to illustrate how useful programs work. All programmers (including aspiring programmers) know how to take a working program and hack it into shape doing what they want it to do. Trying to figure out how to do that from scratch, while also learning program language syntax, the editor, resolving errors, etc. can be overwhelming.