### Related

##### ratexpand

a : in - out;

b : a*K1 + a*K2/s + a...

g : 1/(s^2+3*s+1);

Calculate

##### ratexpand-solve

eq1: z23=ratexpand (1...

eq2: z12=R1+%i*(w*L1...

eq3: z13=z12+z23;

Calculate

##### ratexpand

ratexpand(((k1*(exp(-...

Calculate

##### ratexpand

((x1-v*t1)*(x2-v*t2)-...

Calculate

##### ratexpand-ratsimp

f: (x+y+z)^5;

g:ratexpand(f,x);

h:ratsimp(g,y);

Calculate

##### ratexpand-sqrt

ratexpand(sqrt(2-sqrt...

Calculate

##### ratexpand-ratsimp

f:ratexpand((z1+y+x)^6);

ratsimp(f,y);

Calculate

##### ratexpand-sqrt

ratexpand(sqrt(2-sqrt...

Calculate

##### ratexpand

p : 5*(x+1)*(x+2)*(x+...

ratexpand((p/5)/(x^3));

Calculate

f: (x+y+z)^5;

ratexpand(f);

Calculate

### ratexpand

Run Example
```(%i1)num1: 2*a*x;
(%o1)                                2 a x
(%i2) num2: 2*y*sqrt(a*b*(a*x*x+b*y*y-1));
2      2
(%o2)                   2 y sqrt(a b (b y  + a x  - 1))
(%i3) den: 2*a*(a*x*x+b*y*y);
2      2
(%o3)                          2 a (b y  + a x )
(%i4) x1: (num1+num2)/den;
2      2
2 y sqrt(a b (b y  + a x  - 1)) + 2 a x
(%o4)               ---------------------------------------
2      2
2 a (b y  + a x )
(%i5) x2: (num1-num2)/den;
2      2
2 a x - 2 y sqrt(a b (b y  + a x  - 1))
(%o5)               ---------------------------------------
2      2
2 a (b y  + a x )
(%i6) y1: (1-a*x*x1)/(b*y);
2      2
x (2 y sqrt(a b (b y  + a x  - 1)) + 2 a x)
1 - -------------------------------------------
2      2
2 (b y  + a x )
(%o6)           -----------------------------------------------
b y
(%i7) y2: (1-a*x*x2)/(b*y);
2      2
x (2 a x - 2 y sqrt(a b (b y  + a x  - 1)))
1 - -------------------------------------------
2      2
2 (b y  + a x )
(%o7)           -----------------------------------------------
b y
(%i8) d1_2: fullratsimp(ratexpand((x-x1)^2+(y-y1)^2));
3  6          3      2  2   2    3        2   4
(%o8) - (- a b  y  + ((- a b  - 2 a  b ) x  - b  + 2 a b ) y
2      2            2             3
+ sqrt(a b (b y  + a x  - 1)) ((2 b  - 2 a b) x y
2   3
+ ((2 a b - 2 a ) x  + (2 a - 2 b) x) y)
2  2    3     4       2    2     2    2         2    3    6
+ ((- 2 a  b  - a  b) x  + (a b  + a  b) x  + b  - a b) y  - a  b x
2      3   4     2         2      3  4      2  2  2  2    3    4
+ (2 a  b - a ) x  + (a  - a b) x )/(a b  y  + 2 a  b  x  y  + a  b x )
(%i9) d2_2: fullratsimp((x-x2)^2+(y-y2)^2);
3  6        3      2  2   2    3        2   4
(%o9) (a b  y  + ((a b  + 2 a  b ) x  + b  - 2 a b ) y
2  2    2    2             2             3
+ sqrt(a b  y  + a  b x  - a b) ((2 b  - 2 a b) x y
2   3
+ ((2 a b - 2 a ) x  + (2 a - 2 b) x) y)
2  2    3     4         2    2     2    2         2    3    6
+ ((2 a  b  + a  b) x  + (- a b  - a  b) x  - b  + a b) y  + a  b x
3      2     4           2   2      3  4      2  2  2  2    3    4
+ (a  - 2 a  b) x  + (a b - a ) x )/(a b  y  + 2 a  b  x  y  + a  b x )
(%i10) d12_2: fullratsimp((x2-x1)^2+(y2-y1)^2);
3  4          2      2     2      2   2      3  4      2  2
4 b  y  + ((4 a b  + 4 a  b) x  - 4 b ) y  + 4 a  x  - 4 a  x
(%o10)  --------------------------------------------------------------
3  4      2  2  2  2    3    4
a b  y  + 2 a  b  x  y  + a  b x
(%i11) cosT: (d1_2+d2_2-d12_2)/(2*sqrt(d1_2*d2_2));
3  4          2      2     2      2   2      3  4      2  2
4 b  y  + ((4 a b  + 4 a  b) x  - 4 b ) y  + 4 a  x  - 4 a  x
(%o11) ((- --------------------------------------------------------------
3  4      2  2  2  2    3    4
a b  y  + 2 a  b  x  y  + a  b x
3  6        3      2  2   2    3        2   4
+ (a b  y  + ((a b  + 2 a  b ) x  + b  - 2 a b ) y
2  2    2    2             2             3
+ sqrt(a b  y  + a  b x  - a b) ((2 b  - 2 a b) x y
2   3
+ ((2 a b - 2 a ) x  + (2 a - 2 b) x) y)
2  2    3     4         2    2     2    2         2    3    6
+ ((2 a  b  + a  b) x  + (- a b  - a  b) x  - b  + a b) y  + a  b x
3      2     4           2   2      3  4      2  2  2  2    3    4
+ (a  - 2 a  b) x  + (a b - a ) x )/(a b  y  + 2 a  b  x  y  + a  b x )
3  6          3      2  2   2    3        2   4
- (- a b  y  + ((- a b  - 2 a  b ) x  - b  + 2 a b ) y
2      2            2             3
+ sqrt(a b (b y  + a x  - 1)) ((2 b  - 2 a b) x y
2   3
+ ((2 a b - 2 a ) x  + (2 a - 2 b) x) y)
2  2    3     4       2    2     2    2         2    3    6
+ ((- 2 a  b  - a  b) x  + (a b  + a  b) x  + b  - a b) y  - a  b x
2      3   4     2         2      3  4      2  2  2  2    3    4
+ (2 a  b - a ) x  + (a  - a b) x )/(a b  y  + 2 a  b  x  y  + a  b x ))
!   3  4      2  2  2  2    3    4!                  3  6          3      2  2   2    3        2   4                2      2            2             3                2   3                              2  2    3     4       2    2     2    2         2    3    6       2      3   4     2         2      3  6        3      2  2   2    3        2   4           2  2    2    2             2             3                2   3                            2  2    3     4         2    2     2    2         2    3    6     3      2     4           2
!a b  y  + 2 a  b  x  y  + a  b x !)/(2 sqrt(- (- a b  y  + ((- a b  - 2 a  b ) x  - b  + 2 a b ) y  + sqrt(a b (b y  + a x  - 1)) ((2 b  - 2 a b) x y  + ((2 a b - 2 a ) x  + (2 a - 2 b) x) y) + ((- 2 a  b  - a  b) x  + (a b  + a  b) x  + b  - a b) y  - a  b x  + (2 a  b - a ) x  + (a  - a b) x ) (a b  y  + ((a b  + 2 a  b ) x  + b  - 2 a b ) y  + sqrt(a b  y  + a  b x  - a b) ((2 b  - 2 a b) x y  + ((2 a b - 2 a ) x  + (2 a - 2 b) x) y) + ((2 a  b  + a  b) x  + (- a b  - a  b) x  - b  + a b) y  + a  b x  + (a  - 2 a  b) x  + (a b - a )
2
x )))
(%i12) fullratsimp(ratexpand(cosT));
3  6        3      2  2   2    3        2   4
(%o12) ((a b  y  + ((a b  + 2 a  b ) x  - b  - 2 a b ) y
2  2    2    2           2           3
+ sqrt(a b  y  + a  b x  - a b) ((b  - a b) x y
2   3                                2      2
+ ((a b - a ) x  + (a - b) x) y) + sqrt(a b (b y  + a x  - 1))
2     3      2         3
((a b - b ) x y  + ((a  - a b) x  + (b - a) x) y)
2  2    3     4           2      2     2    2         2    3    6
+ ((2 a  b  + a  b) x  + (- 3 a b  - 3 a  b) x  + b  + a b) y  + a  b x
2      3   4           2   2  !   3  4      2  2  2  2    3    4!
+ (- 2 a  b - a ) x  + (a b + a ) x ) !a b  y  + 2 a  b  x  y  + a  b x !)
3  4      2  2  2  2    3    4               3  6          3      2  2   2    3        2   4                2      2            2             3                2   3                              2  2    3     4       2    2     2    2         2    3    6       2      3   4     2         2      3  6        3      2  2   2    3        2   4           2  2    2    2             2             3                2   3
/((a b  y  + 2 a  b  x  y  + a  b x ) sqrt(- (- a b  y  + ((- a b  - 2 a  b ) x  - b  + 2 a b ) y  + sqrt(a b (b y  + a x  - 1)) ((2 b  - 2 a b) x y  + ((2 a b - 2 a ) x  + (2 a - 2 b) x) y) + ((- 2 a  b  - a  b) x  + (a b  + a  b) x  + b  - a b) y  - a  b x  + (2 a  b - a ) x  + (a  - a b) x ) (a b  y  + ((a b  + 2 a  b ) x  + b  - 2 a b ) y  + sqrt(a b  y  + a  b x  - a b) ((2 b  - 2 a b) x y  + ((2 a b - 2 a ) x  + (2 a - 2 b) x) y)
2  2    3     4         2    2     2    2         2    3    6
+ ((2 a  b  + a  b) x  + (- a b  - a  b) x  - b  + a b) y  + a  b x
3      2     4           2
+ (a  - 2 a  b) x  + (a b - a )
2
x )))
(%i13) ```
Run Example
```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
```ratexpand((x+1)^2*x);
3      2
(%o1)                            x  + 2 x  + x
(%i2) ```

### Related Help

Help for Ratexpand