beautypg.com

Applying a function or program to a list, To run a program or execute a function on lists, Applying a fimction or program to a list -5 – HP 49g Graphing Calculator User Manual

Page 88

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

background image

Applying a Function or program to a List

The

DOLIST

coiranand enables you to run programs or execute fmrctions

on groups of lists.

To run a program or execute a Function on Lists

When you are operating on a number of lists—especially long lists—it
may be easier and clearer if you are in RPN mode (as in the case of the

following example).

1. Enter the lists.

2. Enter the number of lists to be operated on. This number is the number

of elements in each list operated on in each iteration of the function or

program.

3. Enter a program or function.

4. Execute DOLIST.

Example;

Apply the function defined by a,u + (6„ x c„) to three lists,

a,

b, and c.

1. Enter the lists.

For example, ¡1, 2, 3, 4), {4, 5, 6, 7}, and ¡7, 8, 9, 11|.

2. Enter the number of lists to be operated on (for example, 3).

3. Enter the fimction.

« * + »

4. Execute the

DOLIST

command.

0 {PRG)

l

IST

procedures

DOLIST

The answer is {29, 42, 57, 81).

To apply a procedure sequentially to elements of a list

The

DOSlJBS

command enables you to apply a program or function to the

elements in the list one after the other. In RPN mode, the procedure is;

1. Enter the list.

2. Enter the frame index. This is the number of elements affected by each

iteration of the fimction. For example, entering 3 would take 3

elements from the list and use them as arguments for the fimction.

3. Enter a program or function.

4. Execute

DOSUBS.

Lists and Sequences

Page 9-5