RPL Programming Examples 2-15
MULTI is demonstrated in the next programming example.
EXCO (Expand and Collect Completely)
EXCO repeatedly executes EXPAN on an algebraic until the algebraic doesn't change, then repeatedly executes
COLCT until the algebraic doesn't change. In some cases the result will be a number.
Expressions with many products of sums or with powers can take many iterations of EXPAN to expand
completely, resulting in a long execution time for EXCO.
Level 1 " Level 1
'algebraic'
"
'algebraic'
'algebraic'
"
z
Techniques used in EXCO
! Subroutines. EXCO calls the program MULTI twice. It is more efficient to create program MULTI and
simply call its name twice than write each step in MULTI two times.
Required Programs
! MULTI (Multiple Execution) repeatedly executes the programs that EXCO provides as arguments.
EXCO program listing
Program: Comments:
"!
"!<T2B=!1!
Puts a program on the stack as the
level 1 argument for MULTI.
The program executes the
EXPAN command.
M5E:6!
Executes EXPAN until the
algebraic object doesn't change.
"!OLEO:!1
Puts another program on the stack
for MULTI. The program
executes the COLCT command.
M5E:6
Executes COLCT until the
algebraic object doesn't change.
»
`OEXCO K
Stores the program in EXCO.
Checksum: # 41162d
Bytes: 65.5
Example: Expand and collect completely the expression:
3x 4yz+()8x 5z–()
2
+