Every program on the HP48G/GX must be inclosed by a pair of triangular
braces, . This section has two demonstration
programs. The first program will take a square
matrix, *A*, a positive integer *k*, and compute the power of *A*.
The second program will build a square matrix whose entries are the
values of a function at prescribed points. Note, some of the program
lines are ended with a dot and a phrase in italic font. These endings
are for explanatory purposes only. They are not part of the code and
should not be entered into a program.

<<

A K *store matrix and power as local
variables*

<<

A SIZE 1 GET IDN *determine dimension
of A and get same*

*size identity matrix*

K FOR I A * *start FOR loop to
compute powers of A*

NEXT

>>

>>

The structure of the program is fairly simple, however there are several pieces of syntax that need some explanation. If the loop is read as, For I from 1 to K

that piece of the program becomes clear. Note: right after the local variables are created another pair of triangular braces appear. The local variables are recognized only within this succeeding pair of braces, and these braces must be placed after local variables are created. Save the program as A.K.

To use this program place the square matrix whose power you want to compute on stack level 2 and the integer k on level 1. Then push the menu botton corresponding to A.K.

Using the HP48G/GX debugger, it is possible to run this program a step at a time. Push the keys: . Place a square matrix, 2 by 2 is convenient, in stack level 2, and the power k=3 in stack level 1. Now place A.K within tick marks on the command line. Push and then repeatedly push to step through the program one step at a time.

Our second program will construct a square matrix whose entry in the row and column is .

<<

N *create local variable which equals size of
matrix*

<<

N FOR I

N FOR J ` '
NEXT

ARRY *
create row*

NEXT

N ROW *build a matrix of N rows*

>>

>>

Examine this program with the the HP48G/GX debugger also.

Thu Mar 21 09:53:31 CST 1996