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

Algebra Calculator

#### Ratsubst

Function: ratsubst (<a>, <b>, <c>) Substitutes <a> for <b> in <c> and returns the resulting expression. <b> may be a sum, product, power, etc.

ratsubst knows something of the meaning of expressions whereas subst does a purely syntactic substitution. Thus subst (a, x + y, x + y + z) returns x + y + z whereas ratsubst returns z + a.

When radsubstflag is true, ratsubst makes substitutions for radicals in expressions which dont explicitly contain them.

Examples:

(%i1) ratsubst (a, x*y^2, x^4*y^3 + x^4*y^8);
3      4
(%o1)                      a x  y + a
(%i2) cos(x)^4 + cos(x)^3 + cos(x)^2 + cos(x) + 1;
4         3         2
(%o2)       cos (x) + cos (x) + cos (x) + cos(x) + 1
(%i3) ratsubst (1 - sin(x)^2, cos(x)^2, %);
4           2                     2
(%o3)    sin (x) - 3 sin (x) + cos(x) (2 - sin (x)) + 3
(%i4) ratsubst (1 - cos(x)^2, sin(x)^2, sin(x)^4);
4           2
(%o4)                cos (x) - 2 cos (x) + 1
(%i6) ratsubst (u, sqrt(x), x);
(%o6)                           x
(%i8) ratsubst (u, sqrt(x), x);
2
(%o8)                          u

There are also some inexact matches for ratsubst. Try ?? ratsubst to see them.

(%o1)                                true
(%i2)

### Related Examples

##### ratsubst-solve

f1: N = A / l_p^2;

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

f3: E = M * c^2;

Calculate

##### ratsubst

c*2;

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

ratsubst(z,y+x,p);

Calculate

##### ratsubst

expr: exp(1/k)-exp(1/...

ratsubst(0, 1/inf, su...

Calculate

##### ratsubst

G1: Uteil = U48 * R2/...

G2: Uaus = R4/R3 * (U...

G3: Ue2 = Uteil;

Calculate

##### ratsubst

p = x^18;

ratsubst(x+1, x^2, p);

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

expr: exp(1/k)-exp(1/...

ratsubst(0, 1/inf, su...

Calculate

##### ratsubst

eq1: x^3 + a*x + b = 0;

eq2: x = u - v;

ratsubst(eq2,x,eq1);

Calculate

##### ratsubst

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

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

eq2: ratsubst(a,a-z,eq);

Calculate