Reference Guide

RPL Programming Examples 2-15
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:
«
« EXPAN »
Puts a program on the stack as
the level 1 argument for MULTI.
The program executes the
EXPAN command.
MULTI
Executes EXPAN until the
algebraic object doesn’t change.
« COLCT »
Puts another program on the
stack for MULTI. The program
executes the COLCT command.
MULTI
Executes COLCT until the
algebraic object doesn’t change.
»
`O
EXCO K
Stores the program in EXCO.
Checksum: # 41162d
Bytes: 65.5
Example:
Expand and collect completely the expression:
Enter the expression.
O
3
*
X
*
3x 4y z+( ) 8x 5z( )
2
+