size(list) Results
|
02-23-2024, 04:47 PM
Post: #1
|
|||
|
|||
size(list) Results
I seem to run into a problem every time I try to use lists and size, as they can unexpectedly turn into a list of lists instead, and I do not naturally get the way to work with them.
Lets say I have LOCAL DI:=idivis(711000000); PRINT (DI); that prints "[1,2,3,4,5,6,8.........]" Those square brackets mean it is a matrix or vector, don't they? In the manual idivis() says it returns a list. So, If I then: Print size(DI); It returns {294}. - which means that idivis is returning a list of one containing a matrix/vector of length 294? Is there not a way to have it only return a list of 294? It is quite confusing. How can I then access the size of DI as a number - how do I get the result of size(DI) as a number, not a list/vector/matrix. |
|||
02-23-2024, 05:11 PM
Post: #2
|
|||
|
|||
RE: size(list) Results
Bonjour matalog
SIZE() renvoie une liste pour la dimension des matrices {lignes,colonnes}. Pour un vecteur SIZE() considère qu'il s'agit d'une matrice à 1 seule ligne et renvoie {colonnes}. Pour obtenir la taille sous forme de nombre vous pouvez faire GET(SIZE([vecteur]),1). Espérant vous avoir aider. Hello matalog SIZE() returns a list of matrix dimensions {rows,columns}. For a vector, SIZE() assumes it is a 1-line matrix and returns {columns}. To obtain the size as a number, you can do GET(SIZE([vector]),1). Hope to have helped you. Sorry for my english |
|||
02-23-2024, 05:36 PM
Post: #3
|
|||
|
|||
RE: size(list) Results
You can also set DI to a list with :
LOCAL DI:=mat2list(idivis(711000000)); then size(DI) will return 294. |
|||
02-23-2024, 06:06 PM
Post: #4
|
|||
|
|||
RE: size(list) Results
(02-23-2024 04:47 PM)matalog Wrote: In the manual idivis() says it returns a list. From HP Prime help screen, Yes From pdf "Symbolic computation and Mathematics with the calculator HP Prime", No Quote:idivis returns the vector whose components are the divisors of an integer. Quote:It is quite confusing. Instead of size/SIZE, use len/dim |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)