Taking part of a matrix.
06-30-2021, 01:25 PM
Post: #1
 Isai Junior Member Posts: 1 Joined: Jun 2021
Taking part of a matrix.
Is there any way of take part of a matrix? For example in Matlab it could be A(i:j,m:n) to take from i to j rows and m to n columns.
I know that in HP Prime we could take an element of a matrix, A(i,j).
06-30-2021, 02:54 PM
Post: #2
 ijabbott Senior Member Posts: 1,261 Joined: Jul 2015
RE: Taking part of a matrix.
(06-30-2021 01:25 PM)Isai Wrote:  Is there any way of take part of a matrix? For example in Matlab it could be A(i:j,m:n) to take from i to j rows and m to n columns.
I know that in HP Prime we could take an element of a matrix, A(i,j).

This operation is called "slicing" the matrix. I don't think there is anything built-in to do it, except in Python/Numpy.

— Ian Abbott
06-30-2021, 03:22 PM
Post: #3
 robmio Member Posts: 169 Joined: Jan 2020
RE: Taking part of a matrix.
Hi, try using the "SUB" command:

"SUB (Matrix, {rowA, columnA}, {rowB, columnB})".

Look at the attachment.

Attached File(s) Thumbnail(s)

06-30-2021, 04:42 PM
Post: #4
 Didier Lachieze Senior Member Posts: 1,576 Joined: Dec 2013
RE: Taking part of a matrix.
(06-30-2021 01:25 PM)Isai Wrote:  Is there any way of take part of a matrix? For example in Matlab it could be A(i:j,m:n) to take from i to j rows and m to n columns.

From the section "Matrix references" in the Prime manual:
Quote:M1({{1,1},{2,2}}) extracts a sub-matrix from the element in the first row and column to the element in the second row and column.

So your Mathlab example for A(i:j,m:n) would translate on the Prime to M1({{i,m},{j,n}})
 « Next Oldest | Next Newest »

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