A Program To Build A Matrix Out Of A Number Of Lists; Lists Represent Columns Of The Matrix - HP 48gII User Manual

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

The Hilbert matrix has application in numerical curve fitting by the method of
linear squares.

A program to build a matrix out of a number of lists

In this section we provide a couple of UserRPL programs to build a matrix out
of a number of lists of objects. The lists may represent columns of the matrix
(program @CRMC) or rows of the matrix (program @CRMR). The programs are
entered with the calculator set to RPN mode, and the instructions for the
keystrokes are given for system flag 117 set to SOFT menus. This section is
intended for you to practice accessing programming functions in the calculator.
The programs are listed below showing, in the left-hand side, the keystrokes
necessary to enter the program steps, and, in the right-hand side, the
characters entered in the display as you perform those keystrokes. First, we
present the steps necessary to produce program CRMC.

Lists represent columns of the matrix

The program @CRMC allows you to put together a p×n matrix (i.e., p rows, n
columns) out of n lists of p elements each. To create the program enter the
following keystrokes:
Keystroke sequence:
‚ å
„°
@) S TACK! @@DUP@
‚ é # ~ „n
‚ å
1„°
@) S TACK! @SWAP
„°
@) B RCH! @) F OR@! @FOR@
~„j
„°
@) T YPE OBJ
ARRY@
„°
@) B RCH! @) @ IF@@ @@IF@@
~ „j#
~ „n
„°
@) T EST! @@@<@@@
„°
@) B RCH! @) @ IF@ @THEN
~ „j #1+
„°
L
@) S TACK!
@ROLL
„°
@) B RCH! @) @ IF@ @END
Produces:
«
DUP
n
<<
1 SWAP
FOR
j
OBJ
ARRY
IF
j
n
<
THEN
j 1 +
ROLL
END
Page 10-15

Advertisement

Table of Contents
loading

Table of Contents