Expanding And Collecting Completely; Multi (Multiple Execution) - HP 48gII Advanced User's Reference Manual

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

Advertisement

Expanding and Collecting Completely

This section contains two programs:
MULTI repeats a program until the program has no effect on its argument.
!
EXCO calls MULTI to completely expand and collect an algebraic.
!

MULTI (Multiple Execution)

Given an object and a program that acts on the object, MULTI applies the program to the object repeatedly until
the program no longer changes the object.
Level 2
Techniques used in MULTI
DO...UNTIL...END (indefinite loop). The DO clause contains the steps to be repeated. The UNTIL
!
clause contains the test that repeats both clauses again (if false) or exits (if true).
Programs as arguments. Although programs are commonly named and then executed by calling their
!
names, programs can also be put on the stack and used as arguments to other programs.
Evaluation of local variables. The program argument to be executed repeatedly is stored in a local variable.
!
It's convenient to store an object in a local variable when you don't know beforehand how many copies you'll
need. An object stored in a local variable is simply put on the stack when the local variable is evaluated.
MULTI uses the local variable name to put the program argument on the stack and then executes EVAL to
execute the program.
MULTI program listing
Program:
«
 p
«
DO
DUP
p EVAL
DUP
ROT
UNTIL
SAME
END
»
»
`OMULTI K
Checksum: # 22693d
Bytes:
56
2-14 RPL Programming Examples
Level 1
object
«program»
"
Level 1
"
object
result
Comments:
Creates a local variable p that contains the
program from level 1.
Begins the defining procedure.
Begins the DO loop clause.
Makes a copy of the object, now in level 1.
Applies the program to the object, returning
its new version.
Makes a copy of the new object.
Moves the old version to level 1.
Begins the DO test clause.
Tests whether the old version and the new
version are the same.
Ends the DO structure.
Ends the defining procedure.
Stores the program in MULTI.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents