### Related

##### collectterms-expand-phi-ratsimp-subst

P:x^3-6*x^2+12*x-8;

phi: (1*x+2)/(3*x-4);

P1 : collectterms(exp...

Calculate

##### collectterms-ordergreat

p:2*y*z^2+x*z^3+2*x*z^4;

collectterms(p,x);

ordergreat(x,y,z);

Calculate

##### collectterms-expand

f:(x-(1/a)-(1/b))*(x-...

expand(f);

collectterms (f, x);

Calculate

##### collectterms-expand

a:(x-(1/a)-(1/b));

b:(x-(1/b)-(1/c));

c:(x-(1/c)-(1/a));

Calculate

##### collectterms

f : (x^4+(4*x^3)-(17*...

g : (x^2-5*x+3);

collectterms(f*g);

Calculate

##### collectterms-ratsimp

h1: 2*s^3 - 3*s^2 + 1;

h2: -2*s^3 + 3*s^2;

h3: s^3 - 2*s^2 + s;

Calculate

##### collectterms-expand

f:expand((x-1/a-1/b)*...

collectterms(f);

Calculate

##### collectterms-expand

f1: (x-p1)*(q2-q1)-(y...

f2: expand(f1);

collectterms(f2,x,y);

Calculate

##### collectterms-expand

f:((x-(1/a)-(1/b))*(x...

collectterms(expand(f));

Calculate

##### collectterms-expand

f: expand(x-(1/a)-(1/...

collectterms(x);

Calculate

### collectterms

Run Example
```(%i1)h1:  2*s^3 - 3*s^2 + 1;
3      2
(%o1)                           2 s  - 3 s  + 1
(%i2) h2: -2*s^3 + 3*s^2;
2      3
(%o2)                             3 s  - 2 s
(%i3) h3:   s^3 - 2*s^2 + s;
3      2
(%o3)                            s  - 2 s  + s
(%i4) h4:   s^3 -  s^2;
3    2
(%o4)                               s  - s
(%i5) xOft: h1*p1x + h2*p2x + h3*t1x + h4*t2x;
3    2          3      2                    3      2
(%o5) (s  - s ) t2x + (s  - 2 s  + s) t1x + p1x (2 s  - 3 s  + 1)
2      3
+ p2x (3 s  - 2 s )
(%i6) yOft: h1*p1y + h2*p2y + h3*t1y + h4*t2y;
3    2          3      2                    3      2
(%o6) (s  - s ) t2y + (s  - 2 s  + s) t1y + p1y (2 s  - 3 s  + 1)
2      3
+ p2y (3 s  - 2 s )
(%i7) c: b^2*xOft^2 + a^2*yOft^2 - a^2*b^2;
2        3    2          3      2                    3      2
(%o7) a  expt((s  - s ) t2y + (s  - 2 s  + s) t1y + p1y (2 s  - 3 s  + 1)
2      3         2        3    2          3      2
+ p2y (3 s  - 2 s ), 2) + b  expt((s  - s ) t2x + (s  - 2 s  + s) t1x
3      2                2      3         2  2
+ p1x (2 s  - 3 s  + 1) + p2x (3 s  - 2 s ), 2) - a  b
(%i8) collectterms ( ratexpand(c), s );
4   2    2      2              2              2            2    2
(%o8) s  (a  t2y  + 6 a  t1y t2y - 6 a  p2y t2y + 6 a  p1y t2y + b  t2x
2              2              2              2    2       2
+ 6 b  t1x t2x - 6 b  p2x t2x + 6 b  p1x t2x + 6 a  t1y  - 16 a  p2y t1y
2              2    2       2               2              2    2
+ 16 a  p1y t1y + 6 b  t1x  - 16 b  p2x t1x + 16 b  p1x t1x + 9 a  p2y
2              2    2       2              2    2      2    2
- 18 a  p1y p2y + 9 b  p2x  - 18 b  p1x p2x + 9 a  p1y  + 9 b  p1x )
6   2    2      2              2              2            2    2
+ s  (a  t2y  + 2 a  t1y t2y - 4 a  p2y t2y + 4 a  p1y t2y + b  t2x
2              2              2            2    2      2
+ 2 b  t1x t2x - 4 b  p2x t2x + 4 b  p1x t2x + a  t1y  - 4 a  p2y t1y
2            2    2      2              2              2    2
+ 4 a  p1y t1y + b  t1x  - 4 b  p2x t1x + 4 b  p1x t1x + 4 a  p2y
2              2    2      2              2    2      2    2
- 8 a  p1y p2y + 4 b  p2x  - 8 b  p1x p2x + 4 a  p1y  + 4 b  p1x )
5       2    2      2               2               2              2    2
+ s  (- 2 a  t2y  - 6 a  t1y t2y + 10 a  p2y t2y - 10 a  p1y t2y - 2 b  t2x
2               2               2              2    2       2
- 6 b  t1x t2x + 10 b  p2x t2x - 10 b  p1x t2x - 4 a  t1y  + 14 a  p2y t1y
2              2    2       2               2               2    2
- 14 a  p1y t1y - 4 b  t1x  + 14 b  p2x t1x - 14 b  p1x t1x - 12 a  p2y
2               2    2       2               2    2       2    2
+ 24 a  p1y p2y - 12 b  p2x  + 24 b  p1x p2x - 12 a  p1y  - 12 b  p1x )
3       2              2              2              2              2    2
+ s  (- 2 a  t1y t2y + 2 a  p1y t2y - 2 b  t1x t2x + 2 b  p1x t2x - 4 a  t1y
2              2              2    2      2              2
+ 6 a  p2y t1y - 4 a  p1y t1y - 4 b  t1x  + 6 b  p2x t1x - 4 b  p1x t1x
2              2              2    2      2    2
- 4 a  p1y p2y - 4 b  p1x p2x + 4 a  p1y  + 4 b  p1x )
2       2              2            2    2      2            2    2
+ s  (- 2 a  p1y t2y - 2 b  p1x t2x + a  t1y  - 4 a  p1y t1y + b  t1x
2              2              2              2    2      2    2
- 4 b  p1x t1x + 6 a  p1y p2y + 6 b  p1x p2x - 6 a  p1y  - 6 b  p1x )
2              2             2    2    2    2    2  2
+ s (2 a  p1y t1y + 2 b  p1x t1x) + a  p1y  + b  p1x  - a  b
(%i9) ```
Run Example
```a : diff(bessel_j(0,sqrt(t^2-x^2-y^2-z^2)),t)/t ;
2    2    2    2
bessel_j(1, sqrt(- z  - y  - x  + t ))
(%o1)              - --------------------------------------
2    2    2    2
sqrt(- z  - y  - x  + t )
(%i2) b : factor(diff(a,x,2) + diff(a,y,2) + diff(a,z,2) - diff(a,t,2));
2    2    2    2           2    2    2    2
(%o2) (2 bessel_j(2, sqrt(- z  - y  - x  + t )) sqrt(- z  - y  - x  + t )
2    2    2    2           2    2    2    2
- 2 bessel_j(0, sqrt(- z  - y  - x  + t )) sqrt(- z  - y  - x  + t )
2    2    2    2    2
+ bessel_j(3, sqrt(- z  - y  - x  + t )) z
2    2    2    2    2
- 3 bessel_j(1, sqrt(- z  - y  - x  + t )) z
2    2    2    2    2
+ bessel_j(3, sqrt(- z  - y  - x  + t )) y
2    2    2    2    2
- 3 bessel_j(1, sqrt(- z  - y  - x  + t )) y
2    2    2    2    2
+ bessel_j(3, sqrt(- z  - y  - x  + t )) x
2    2    2    2    2
- 3 bessel_j(1, sqrt(- z  - y  - x  + t )) x
2    2    2    2    2
- bessel_j(3, sqrt(- z  - y  - x  + t )) t
2    2    2    2    2
+ 3 bessel_j(1, sqrt(- z  - y  - x  + t )) t
2    2    2    2
+ 4 bessel_j(1, sqrt(- z  - y  - x  + t )))
2    2    2    2    2    2    2    2
/(4 sqrt(- z  - y  - x  + t ) (z  + y  + x  - t ))
(%i3) collectterms(b,bessel_j(1, sqrt(- z^2  - y^2  - x^2  + t^2 ))) ;
2    2    2    2           2    2    2    2
(%o3) (2 bessel_j(2, sqrt(- z  - y  - x  + t )) sqrt(- z  - y  - x  + t )
2    2    2    2           2    2    2    2
- 2 bessel_j(0, sqrt(- z  - y  - x  + t )) sqrt(- z  - y  - x  + t )
2    2    2    2    2
+ bessel_j(3, sqrt(- z  - y  - x  + t )) z
2    2    2    2    2
- 3 bessel_j(1, sqrt(- z  - y  - x  + t )) z
2    2    2    2    2
+ bessel_j(3, sqrt(- z  - y  - x  + t )) y
2    2    2    2    2
- 3 bessel_j(1, sqrt(- z  - y  - x  + t )) y
2    2    2    2    2
+ bessel_j(3, sqrt(- z  - y  - x  + t )) x
2    2    2    2    2
- 3 bessel_j(1, sqrt(- z  - y  - x  + t )) x
2    2    2    2    2
- bessel_j(3, sqrt(- z  - y  - x  + t )) t
2    2    2    2    2
+ 3 bessel_j(1, sqrt(- z  - y  - x  + t )) t
2    2    2    2
+ 4 bessel_j(1, sqrt(- z  - y  - x  + t )))
2    2    2    2    2    2    2    2
/(4 sqrt(- z  - y  - x  + t ) (z  + y  + x  - t ))
(%i4) ```
Run Example
```M:matrix([0,-(z+c),(y+b)],[(z+c),0,-(x+a)],[-(y+b),(x+a),0]);
[    0     - z - c   y + b  ]
[                           ]
(%o1)                    [  z + c      0     - x - a ]
[                           ]
[ - y - b   x + a      0    ]
(%i2) N:matrix([p,q,r]);
(%o2)                             [ p  q  r ]
(%i3) E:M.N;
[ q (- z - c) + r (y + b) ]
[                         ]
(%o3)                     [ p (z + c) + r (- x - a) ]
[                         ]
[ p (- y - b) + q (x + a) ]
(%i4) F: collectterms(E[1,1],a,b,c);
(%o4)                       q (- z - c) + r (y + b)
(%i5) facsum(F,a,b,c);
(%o5)                       - q z + r y + b r - c q
(%i6) ```

### Related Help

Help for Collectterms