Function Diag - HP 49g+ User Manual

Graphing calculator.

Function →DIAG
Function
DIAG takes the main diagonal of a square matrix of dimensions
n×n, and creates a vector of dimension n containing the elements of the main
diagonal. For example, for the matrix remaining from the previous exercise,
we can extract its main diagonal by using:
In RPN mode, with the 3×3 matrix in the stack, we simply have to activate
DIAG to obtain the same result as above.
function

Function DIAG→

Function DIAG
takes a vector and a list of matrix dimensions {rows,
columns}, and creates a diagonal matrix with the main diagonal replaced
with the proper vector elements. For example, the command
DIAG ([1,-1,2,3],{3,3})
produces a diagonal matrix with the first 3 elements of the vector argument:
In RPN mode, we can use [1,-1,2,3] ` {3,3}` DIAG
obtain the same result as above.
Another example of application of the DIAG
In RPN mode, use [1,2,3,4,5] ` {3,2}` DIAG
In this case a 3×2 matrix was to be created using as main diagonal elements
as many elements as possible form the vector [1,2,3,4,5]. The main diagonal,
for a rectangular matrix, starts at position (1,1) and moves on to position (2,2),
(3,3), etc. until either the number of rows or columns is exhausted. In this
case, the number of columns (2) was exhausted before the number of rows (3),
function follows, in ALG mode:
.
to
Page 10-13