Examples, Examples -13 – HP 38g Graphing Calculator User Manual

Page 143

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

Advertising
background image

Examples

Filling

You can create and fill a matrix with zeros for the diagonal

Matrices

elements and ones for the off-diagonal elements using the

MAKEMAT

(make matrix)

function. For example, entering

MAKEMAT (

IA J, 4,4

)

creates a 4

X

4 matrix with ones for all

elements except zeros on the diagonal. The logical operator

A returns 0 when I (the row number) and J (the column

number) are equal, and returns 1 when they are not equal.

Identity Matrix

You can create an identity matrix with the IDENMAT

function. For example,

ideimat

(2) creates the 2 x2 identity

matrix [[1,0],[0,1]].

Redimension a

Suppose the variable MO is a 2x2 matrix containing

Matrix

[[3,4],[5,6]]. The programming command

REDIM MO; { 2 , 1 } would redimension it to a matrix of

2rowsxl column, [ [3], [4]]. The command REDiM MO; {4}

would redimension it to the column vector [3,4,5,6]. To see

the redimensioned matrix, either recall the matrix to the edit

line (|A...z|M 0 I ENTER I), or use the Matrix editor

(■ [MATRIX]).

Transposing

a

The TRN function swaps the row-column and column-row

Matrix

elements of a matrix. For instance, element 1,2 (row 1,

column 2) is swapped with element 2,1, element 2,3 is

swapped with element 3,2, and so on.

For example,

TRN ( [ [ 1 , 2 ] , [ 3 , 4 ] ] )

creates the matrix

[ [ 1 , 3 ] , [ 2 , 4 ] ] .

Using Matrices 6-13

Advertising