Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Subst

Function: subst (<a>, <b>, <c>) Substitutes <a> for <b> in <c>. <b> must be an atom or a complete subexpression of <c>. For example, `x+y+z` is a complete subexpression of `2*(x+y+z)/w` while `x+y` is not. When <b> does not have these characteristics, one may sometimes use `substpart` or `ratsubst` (see below). Alternatively, if <b> is of the form `e/f` then one could use `subst (a*f, e, c)` while if <b> is of the form `e^(1/f)` then one could use `subst (a^f, e, c)`. The `subst` command also discerns the `x^y` in `x^-y` so that `subst (a, sqrt(x), 1/sqrt(x))` yields `1/a`. <a> and <b> may also be operators of an expression enclosed in double-quotes `"` or they may be function names. If one wishes to substitute for the independent variable in derivative forms then the `at` function (see below) should be used. `subst` is an alias for `substitute`.

`subst (<eq_1>, <expr>)` or `subst ([<eq_1>, ..., <eq_k>], <expr>)` are other permissible forms. The <eq_i> are equations indicating substitutions to be made. For each equation, the right side will be substituted for the left in the expression <expr>.

`exptsubst` if `true` permits substitutions like `y` for `%e^x` in `%e^(a*x)` to take place.

When `opsubst` is `false`, `subst` will not attempt to substitute into the operator of an expression. E.g. `(opsubst: false, subst (x^2, r, r+r))` will work.

Examples:

```          (%i1) subst (a, x+y, x + (x+y)^2 + y);
2
(%o1)                      y + x + a
(%i2) subst (-%i, %i, a + b*%i);
(%o2)                       a - %i b```

For further examples, do `example (subst)`.

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

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

### Related Examples

##### subst-tan

Cu2:(2*pi*n/60)*(D2a/...

Cu2_now:subst(B2s_now...

Cu2_target:subst(B2s_...

Calculate

##### subst

subst(B1+B2,B,subst(b...

Calculate

##### subst

eq1: 51*x^2-237*x-1613;

subst(3,x,eq1);

Calculate

##### subst

subst([x = a + 4], (x...

Calculate

r1: [a,b];

r2: [c, d];

r1: r1*(a^x);

Calculate

? subst;

Calculate

r1: [a,b];

r2: [c, d];

r1: r1*(a^x);

Calculate

subst(3,x,p);

Calculate

##### subst

x*x + y*y = r^2;

subst(x, px + lambda ...

Calculate

##### subst

eq1:v=c*(f0-f)/f0;

eq2:subst(f0=f0+d,eq1);

eq1-eq2;

Calculate 