• Aucun résultat trouvé

(Note that the yields of the respective options are simply |_J

Dans le document Publishing of is (Page 79-82)

approximations, and the total of the Yield column is meaningless.)

U

u

Recreations and Applications 1

H

n

n

n

Spreadsheet Model

Passbook Trs. Bill U.S. Bond All Saver Total

Principal Ytel

$10>000 ,06

$8,000 .09

$ii,ooo ;ii

$5,000 .12

$34,000, ,a8r

* <■',' *■ 'Wlv/vwv * *" " 9Q^y / , j'Vci't-vW

n

In applying this model to the spreadsheet program, four columns are defined (Principal, Yield, Net, and Earning), and five rows (Passbook, Treasury Bills, U.S. Bonds, All Saver Certificate, and Total). Several mathematical relationships are defined as well: the Net column is defined as the product of the Yield and the Principal, added to the Principal; the Earn ings column is defined as the product of the Yield and Prin cipal; and the Total row is defined as the sum of the numbers in each column.

Once these definitions are set up, you can experiment by simply changing the given values. The spreadsheet program will then automatically recalculate the other values. For in stance, if you were to change the Principal in this example, the program would then recalculate the Earnings, the Net, and the Totals.

Operating 64 Spreadsheet

Using the spreadsheet program is not difficult—in most cases the program prompts you for the data it needs. The only com plicated part is setting up the model at the start. The best way to learn is by doing, so we'll demonstrate by setting up a working model of the example shown in the figure.

The first step is to type in LOAD and RUN the

spreadsheet program. When run, the screen clears and a list of commands appears at the bottom of the screen. This is the normal operating mode. If a model were set up, it would be

displayed above the command list, and you could experiment with it by changing values. However, if you're just starting out, or beginning a new model, you need to program a model.

73

1 Recreations and Applications

Programming the Model. To do this you must enter the Program mode, which is the first option in the command list.

Simply hit the P key. The screen again clears, a list of num bers appears on the left side of the screen, and a new list of commands appears in the bottom three rows. The list of num bers on the side are line numbers; on these lines the definition for the model will be stored.

To do this, use the Insert command (the first option now on the screen) by typing 7. The computer will then ask which line the inserted text should be placed before. Type 1—this line now contains an END statement which should be the last statement of the model definition. Next, the computer asks how many lines are to be inserted; in this case, enter 22.

Row and Column. Beginning with line 1 and continuing to line 12, the computer will prompt you for each line. In response, type the following lines, which will be explained as we go along.

1 NAME RA=PASSBK

(The line numbers don't have to be typed; the program supplies them.) This line gives the first row of our example the name PASSBK, representing passbook savings, which will be displayed on the left side of the screen in the normal operat ing mode. In the designation RA, the R indicates that we are naming a row, and the A indicates the row A, or the first row.

Only six characters or less are allowed for a row name. There are 20 rows, each designated by a single letter. Now enter:

2 NAME RB=TRSBIL 3 NAME RC=USBOND 4 NAME RD=ALSAV 5 NAME RE=TOTAL

These are the same as line 1, except they name rows B, C, , .

D, and E. To name the columns, you could begin by typing: LJ

6 NAME C1=PRNCPL,6

This names the first column, column 1, PRNCPL. In this [_J

case, the C indicates that it's a column, and the 1 indicates col umn 1. In addition to their names, columns must also be given

a width—in this example, a width of 6. If no width is given, | j

the program defaults to five characters. Every element in the column, including the column name itself, must have a length

equal to or less than the given width. |_J

u

Recreations and Applications 1

7 NAME C2=YIELD,5 8 NAME C3=NET,6 9 NAME C4=EARN,6

These are similar to line 6 except that they name columns 2, 3, and 4, respectively.

DEFINE. The next line might be hard to understand at first. It's the first mathematical expression used, and its pur pose is to set the NET column equal to the product of the PRINCIPAL column and the YIELD column added to the PRINCIPAL column. To understand the command, you must understand the designations used. Enter line 10 as follows:

10 DEFINE @3=@1*@2+@1

First of all, every element in the matrix of rows and col umns has its own designation, which is simply the element's row letter followed by its column number. That is, element C2 is row C, column 2.

The DEFINE command then sets an element equal to an expression containing other elements, and possibly constants such as 2 or .56. Any of the four basic operations of addition, subtraction, multiplication, and division can be used. How ever, no hierarchy of operations is followed.

In a definition command, it might be useful to consider more than one element at a time. You can use the @ symbol to do this. It can be used to replace either the column or row designation. For example, in the DEFINE command above,

@3 indicates all rows in column 3. Note that in the use of @, each element will still be considered separately. The whole statement can thus be translated to each row in column three equals each row in column one times each row in column two, plus each row in column one. Make sure the @ symbol precedes _ the column number and follows the row letter.

Dans le document Publishing of is (Page 79-82)