### The Maxima on-line user's manual

Algebra Calculator

#### Collapse

Function: collapse (<expr>) Collapses <expr> by causing all of its common (i.e., equal) subexpressions to share (i.e., use the same cells), thereby saving space. (`collapse` is a subroutine used by the `optimize` command.) Thus, calling `collapse` may be useful after loading in a `save` file. You can collapse several expressions together by using `collapse ([<expr_1>, ..., <expr_n>])`. Similarly, you can collapse the elements of the array `A` by doing `collapse (listarray (`A)).

```(%o1)                                true
(%i2) ```

### Related Examples

##### collapse-ratsimp-xthru

a: 1/(c-d)-c/(c^2-d^2...

xthru(a);

b:ratsimp(a);

Calculate

##### collapse-constant-declare-optimize-ratsimp-xthru

declare(c,constant);

declare(d,constant);

declare(x,constant);

Calculate

##### collapse-linsolve-lsum

eq1 : I + ri*t*B = mi;

eq2 : O + ro*(1-t)*B ...

eq3 : B = t*I + (1-t)*O;

Calculate

? collapse;

Calculate

##### collapse-expand-sqrt

a:-sqrt(-1)/o/P*(-sqr...

b:expand(a);

c:collapse(b);

Calculate

##### collapse-ratsimp-xthru

a: 1/(c-d)-c/(c^2-d^2...

xthru(a);

b:ratsimp(a);

Calculate

##### collapse-expand-sqrt

a:-sqrt(-1)/o/P*(-sqr...

b:expand(a);

c:collapse(b);

Calculate

? collapse;

Calculate

##### collapse

collapse((a+1)>(a+...

Calculate

##### collapse-expand

eq1:zz : a + b*xx + c...

eq2: expand(eq1);

collapse(eq2);

Calculate