# COLCT

Algebra
Argument Types:
Real
Complex
Symbol
Expression
Result Type(s):
Real
Complex
Symbol
Expression
Invertible:
No
Valid In Expression:
No
Stack Diagram:
 Real1 → Real2 Complex1 → Complex2 Symbol1 → Symbol2 Expression1 → Expression2

The COLCT operation collects terms and factors in order to simplify an expression. It does this by doing the following things:

• It evaluates any parts of the expression which have numerical arguments.
• It collects together real and complex terms across addition and subtraction. So, if you have an expression like '10+X-(1,2)', it will return '(9,-2)+X'.
• It collects together real and complex factors across multiplication and division. So, if you have an expression like '(2,4)*X/2', it will return '(1,2)*X'.
• It reorders the components of a sequence of addition and subtraction terms, combining like terms together as much as possible. This means an expression like 'Y+Z+4*X-Z+10+2*Y-X' will become '10+3*X+3*Y'.
• It reorders the components of a sequence of multiplication and division factors, combining like factors together as much as possible. This means an expression like 'SQ(X)*Y^3*Z^A/X*Y^-4*Z' will become 'X*Z^(1+A)/Y'.

If the COLCT operation encounters an operation it cannot collect, it will try to collect the arguments to that operation. So, 'SIN(10+X+2+X)' will become 'SIN(12+2*X)'.

Similarly, each factor or term can be an expression that collect can't necessarily operate on but it will still collect them. So, 'SIN(X)+2*SIN(X)' will become '3*SIN(X)'.

The COLCT operation attempts to perform all possible collect opportunities across the whole expression in a single call. Re-executing COLCT a second time should never result in a further "collected" expression. This differs from EXPAN which will perform a single expansion with every execution until no further expansions are possible.