Next: Programming Up: How to Use the Previous: Derivatives and Integrals

# Arrays

The HP48G/GX recognizes two types of arrays, matrices and vectors. They are distinguished by the number of rectangular brackets surrounding the entries. Matrices are enclosed by [[ ]], while vectors are enclosed by [ ].

A matrix or a vector can be entered two ways: by opening the matrix editor , or by command line entries. I will demonstrate command line entering and let you play with the matrix editor. Suppose we want to enter the matrix:

Perform the following keystrokes: 2pt 2pt

Notice that the number of columns in our matrix is determined by the number of items within the second set of brackets. The HP48G/GX will then fill each successive row until it has used all of the numbers given to it. If there are not enough entries to complete a row, an error message will be given. An easy way to edit some of the entries in a matrix already entered is to use the matrix editor. This editor can be accessed by placing the matrix in stack level one and then pushing the key . This will open up the matrix editor with the given matrix entered into the editor. If, after some changes have been made, you decide to keep the original matrix, push . If you want to keep the changes, push .

The syntax for multiplying matrices and vectors is exactly the same as for numbers. If you try to add or multiply matrices that are not of the proper size, an error message will be given. The same applies to the algebraic operation of matrix addition.

The best known method for solving a system of linear equations, Gaussian elimination, involves performing a sequence of elementary row operations on the augmented matrix of the system. The HP48G/GX has these operations built into it. They are located in the MTH MATR ROW menus. Go there now. Menu items 5, 6, and 7 perform the elementary row operations. In the following it is assumed that the matrix being transformed is in stack level one.

• Multiply a row by a nonzero constant
RCI: In the command line place the constant, a space, and then the row number. Push .
• Multiply a row by a constant and add it to a different row
RCIJ: In the command line place the constant, a space, the number of the row being multiplied, a space, and then the number of the row being added to. Push .

• Interchange two rows
RSWP: In the command line place the numbers of the rows being interchanged. Be sure the separate the row numbers with a space. Push .
The first four menu items are used to build or break apart matrices by their rows. See the manual for more details. The HP48G/GX also has a built in command to swap columns. This command is found in MTH MATR COL. In this menu, there are also commands that build up or break apart a matrix by columns.

The HP48G/GX also has a built in solver for a linear system of equations. In fact, this solver will automatically find a unique solution for systems that may not have an actual solution or may have more than one solution. The HP48G/GX finds the least square solution to every system it is given to solve. For example, suppose we want a solution to the system:

Notice first that this system has no solution, and secondly if it did, there would be an infinite number of solutions. No matter, let's use the HP48G/GX to solve this system. Open up the solve menu, 2pt . Highlight Solve lin sys, push . Enter the coefficient matrix in the A: field, the right hand side of the system as a vector in the B: field, and then highlight the X: field. Push . The HP48G/GX has constructed the least squares solution of minimal norm to this system. To view this least squares solution, highlight the X field and push edit.

Next: Programming Up: How to Use the Previous: Derivatives and Integrals

Mike Stecher
Thu Mar 21 09:53:31 CST 1996