### Related

##### ratsubst

c*2;

p:x+y+1/(x+y);

ratsubst(z,y+x,p);

Calculate

##### ratsubst-solve

f1: N = A / l_p^2;

f2: E = (1/2) * N * k...

f3: E = M * c^2;

Calculate

##### ratsubst-solve-sqrt

Z0: ((x/a) - (b/c))/SE;

Z1: ratsubst(sqrt(p*(...

Z2: ratsubst(((x/a)*a...

Calculate

##### ratsubst-sqrt

Z0: ((x/a) - (b/c))/SE;

ratsubst(sqrt(p*(1-p)...

ratsubst(((x/a)*a+(b/...

Calculate

##### ratsubst

eq: (yx+1)*(x^2-y)^2-...

eq1: ratsubst(x^2,a+y...

Calculate

##### ratsubst-solve

f1: N = A / l_p^2;

f2: E = (1/2) * N * k...

f3: E = M * c^2;

Calculate

##### ratsubst-solve

f1: N = A / l_p^2;

f2: E = (1/2) * N * k...

f3: E = M * c^2;

Calculate

##### ratsubst-solve

f1: N = A / l_p^2;

f2: E = (1/2) * N * k...

f3: E = M * c^2;

Calculate

##### ratsubst-solve

f1: N = A / l_p^2;

f2: E = (1/2) * N * k...

f3: E = M * c^2;

Calculate

##### ratsubst

ratsubst (a, x*y^2, x...

Calculate

### ratsubst

Run Example
```(%i1)Z0: (p1 - p2)/SE;
p1 - p2
(%o1)                               -------
SE
(%i2) Z1 : ratsubst(sqrt(p*(1-p)*((1/n1)+(1/n2))),SE,Z0);
p2 - p1
(%o2)                     - -------------------------
1    1
sqrt((-- + --) (1 - p) p)
n2   n1
(%i3) Z2 : ratsubst((p1*n1+p2*n2)/(n1+n2),p,Z1);
p2 - p1
(%o3) - --------------------------------------------------------------------
2    2                                        2    2
n2  (p2  - p2) + n1 n2 ((2 p1 - 1) p2 - p1) + n1  (p1  - p1)
sqrt(- ------------------------------------------------------------)
2     2
n1 n2  + n1  n2
(%i4) Z3 : ratsubst(x*p2,p1,Z2);
(%o4)
p2 x - p2
-----------------------------------------------------------------------------
2    2  2                 2            2                         2
p2  (n1  x  + 2 n1 n2 x + n2 ) + p2 (- n1  x + n1 n2 (- x - 1) - n2 )
sqrt(- ---------------------------------------------------------------------)
2     2
n1 n2  + n1  n2
(%i5) solve(Z3,x);
(%o5)                               [x = 1]
(%i6) ```
Run Example
```eq: ratsubst(sin(a)^2,1-cos(a)^2,trigexpand(cos(9*a)));
8                    6                    4
(%o1) 256 cos(a) sin (a) - 448 cos(a) sin (a) + 240 cos(a) sin (a)
2
- 40 cos(a) sin (a) + cos(a)
(%i2) ```
Run Example
```k:0;
(%o1)                                  0
(%i2) deg:8;
(%o2)                                  8
(%i3) f(s,k,deg):=block([eq],eq:expand(sum(a[2*ii]*(s-s0)^(2*ii),ii,0,deg)),if k>
0 then ( eq: diff(eq,s,k) ),return(eq));
(%o3) f(s, k, deg) := block([eq], eq :
2 ii
expand(sum(a     (s - s0)    , ii, 0, deg)),
2 ii
if k > 0 then eq : diff(eq, s, k), return(eq))
(%i4) g(s,k,deg):=block([eq],eq:expand(sum((-s)^ii*sum(a[2*jj]*binomial(2*jj,ii)*s0^(2*jj-ii),jj,ceiling(ii/2),deg),ii,0,deg)),if k>
0 then ( eq: diff(eq,s,k) ),return(eq));
(%o4) g(s, k, deg) := block([eq], eq :
ii                                2 jj - ii              ii
expand(sum((- s)   sum(a     binomial(2 jj, ii) s0         , jj, ceiling(--),
2 jj                                             2
deg), ii, 0, deg)), if k > 0 then eq : diff(eq, s, k), return(eq))
(%i5) ff:ratsubst(0,s^(deg/2),f(s,k,deg));
16              15             2          14
(%o5) a   s0   - 16 a   s s0   + (120 a   s  + a  ) s0
16            16                16       14
3               13            2          12
+ (- 560 a   s  - 14 a   s) s0   + (91 a   s  + a  ) s0
16          14                14       12
3               11            2          10
+ (- 364 a   s  - 12 a   s) s0   + (66 a   s  + a  ) s0
14          12                12       10
3               9            2         8
+ (- 220 a   s  - 10 a   s) s0  + (45 a   s  + a ) s0
12          10               10       8
3             7           2         6
+ (- 120 a   s  - 8 a  s) s0  + (28 a  s  + a ) s0
10         8               8       6
3             5           2         4             3             3
+ (- 56 a  s  - 6 a  s) s0  + (15 a  s  + a ) s0  + (- 20 a  s  - 4 a  s) s0
8         6               6       4               6         4
2         2            3                    2
+ (6 a  s  + a ) s0  + (- 4 a  s  - 2 a  s) s0 + a  s  + a
4       2              4         2          2       0
(%i6) gg:ratsubst(0,s^(deg/2),g(s,k,deg));
16              15             2          14
(%o6) a   s0   - 16 a   s s0   + (120 a   s  + a  ) s0
16            16                16       14
3               13            2          12
+ (- 560 a   s  - 14 a   s) s0   + (91 a   s  + a  ) s0
16          14                14       12
3               11            2          10
+ (- 364 a   s  - 12 a   s) s0   + (66 a   s  + a  ) s0
14          12                12       10
3               9            2         8
+ (- 220 a   s  - 10 a   s) s0  + (45 a   s  + a ) s0
12          10               10       8
3             7           2         6
+ (- 120 a   s  - 8 a  s) s0  + (28 a  s  + a ) s0
10         8               8       6
3             5           2         4             3             3
+ (- 56 a  s  - 6 a  s) s0  + (15 a  s  + a ) s0  + (- 20 a  s  - 4 a  s) s0
8         6               6       4               6         4
2         2            3                    2
+ (6 a  s  + a ) s0  + (- 4 a  s  - 2 a  s) s0 + a  s  + a
4       2              4         2          2       0
(%i7) rat(ff-gg);
(%o7)/R/                               0
(%i8) ```

### Related Help

Help for Ratsubst