Post Reply 
matrix how to call just a column like A( : , 2 )
03-05-2020, 05:44 PM (This post was last modified: 03-05-2020 05:52 PM by resolved.)
Post: #1
matrix how to call just a column like A( : , 2 )
how do you call just one column of a matrix
in matlab it is something like A( : , 2 )
A [[a,b,c],[d,e,f],[g,h,i]]
I call one element A(3,2) will get me h
but if I want [b,e,h] how do I get just the second column??
Find all posts by this user
Quote this message in a reply
03-05-2020, 06:06 PM
Post: #2
RE: matrix how to call just a column like A( : , 2 )
Hello
In the manual you will find:
col([matrix],x)
Will give you the column number x.
Find all posts by this user
Quote this message in a reply
03-05-2020, 10:59 PM
Post: #3
RE: matrix how to call just a column like A( : , 2 )
it is in the manual ?? really??
chapter 27 matrix pages 560 through 597 does not mention it, great, that is where one would expect to find it.
searched for the command -- yup there it is, page 464 in chapter 23 Functions and commands.
you would never be able to find the command if you didn't already know the command!!! What good is a manual to someone learning when the manual requires you to know the command before you can find it.

thanks for the help -- I would have never found the command in the manual without your help. By not knowing the secrete code it is impossible to find in the manual, unless you can read and retain 761 pages of information, I cannot and if I already knew what I was looking for, then I wouldn't need the manual. Catch22
Find all posts by this user
Quote this message in a reply
03-05-2020, 11:45 PM
Post: #4
RE: matrix how to call just a column like A( : , 2 )
Most of the time I consult the XCAS manual and then proceed to check if the function is implemented in the calculator.

I'd reccomend that if, like me, you use mostly the CAS environment.

That being said, the best resource on Prime functions, commands, etc currently is the contextual help menu, not the Hp manual.
Find all posts by this user
Quote this message in a reply
03-06-2020, 12:26 AM
Post: #5
RE: matrix how to call just a column like A( : , 2 )
Searching the built in help on the calculator would have found it quite quickly i think.

Search "column" in the on-calc help and you will go through all places columns are mentioned, and come across "col" which reads:

"Syntax:
col(Matrix, Integer) or
col(Matrix, Interval)

Returns the column n or the sequence of the columns n1 … n2 of the matrix A.


Example:
col([[1,2,3],[4,5,6],[7,8,9]],2) → [2,5,8]
"

You could have also opened the full catalog that lists every command in the system, started typing "column" and it would have dropped you into those commands. A tap on help would have brought up the info on the various commands there till you found it.

I understand your frustration, but I do not know what could be done different here. Not sure how to further improve "i don't know what the name of something is nor where to find it" problem though. Where would you have placed it?

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
03-06-2020, 02:39 AM
Post: #6
RE: matrix how to call just a column like A( : , 2 )
I know, I know, I know, ask me xD

HP PPL
Read: A(-2)
Write: A(-2):=[b2,e2,h2]

CAS
Only Read: col(A,2)

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
03-06-2020, 06:20 AM (This post was last modified: 03-06-2020 06:22 AM by resolved.)
Post: #7
RE: matrix how to call just a column like A( : , 2 )
Thanks Victorbc -- I have the HP manual, where can I get the XCAS manual?? regarding the contextual help menu if you mean the help button on the HP Prime, still requires I know the command ahead of time.

I thought the problem was syntax, I am use to matlab & mathematica -- never even thought it would require a command

Thanks Tim -- didn't know there was a search feature in the Prime, found it in Tree and nowhere else, still took me half an hour to find the command -- deciphering the other commands along the way. I have used the catalog before, didn't know you could type more than one letter, but you have to be very quick on the keyboard, practice ahead of time, the best I got was three letters
"I do not know what could be done different here" -- standardization, I think is the answer, if every program used different key combinations for copy and paste, most people would just give up. Also in chapter 27 matrix should have all the commands related to that subject, I think is a no brainer.

just look at the Prime for columns in matrix, different command in Home than in CAS, if that isn't confusing, btw Thanks Carlos295z for mentioning that, in Home there is no command to search for, it is purely syntax and you can not search for that -- well, not that I know of, also using A(-2) to read column two is a secret code, not in the manual, not to be figured out, not to be found except for the kindness of others.

this one command has cost me four hours and the sad part of it is that in two weeks I will forget and it will cost me another hour trying to figure out how I did it before. I have bookmarked this site so I hope the journey will be much shorter, and thanks for caring, giving people who make life just a little bit easier
Find all posts by this user
Quote this message in a reply
03-06-2020, 07:36 AM
Post: #8
RE: matrix how to call just a column like A( : , 2 )
Inside CAS, you can type A[:,2] (indices starting at 0, this is Python syntax compatibility). This will return a row vector, in read/write mode.
Find all posts by this user
Quote this message in a reply
03-06-2020, 10:09 AM
Post: #9
RE: matrix how to call just a column like A( : , 2 )
(03-06-2020 06:20 AM)resolved Wrote:  it will cost me another hour trying to figure out how I did it before

It's time to make me famous Tongue
I wrote some main notes on matrix management: Matriz (Spanish)

It is usually content that is not found in the manuals, so also check the commands that are easily found in the program editor.
[Image: 49626090001_d97c9f2359_o.png]

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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