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. |
|
| » |
|
|
|
|
|
|
| `OEXCO K | Stores the program in EXCO. |
|
|
| |
|
|
| |
Checksum: # 41162d |
| ||
Bytes: | 65.5 |
|
|
Example: Expand and collect completely the expression:
3x(4y+z)
Enter the expression.
O3 *X *
RPL Programming Examples