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

Algebra Calculator

#### Substpart

Function: substpart (<x>, <expr>, <n_1>, ..., <n_k>) Substitutes <x> for the subexpression picked out by the rest of the arguments as in `part`. It returns the new value of <expr>. <x> may be some operator to be substituted for an operator of <expr>. In some cases <x> needs to be enclosed in double-quotes `"` (e.g. `substpart ("+", a*b, 0)` yields `b + a`).

```          (%i1) 1/(x^2 + 2);
1
(%o1)                        ------
2
x  + 2
(%i2) substpart (3/2, %, 2, 1, 2);
1
(%o2)                       --------
3/2
x    + 2
(%i3) a*x + f(b, y);
(%o3)                     a x + f(b, y)
(%i4) substpart ("+", %, 1, 0);
(%o4)                    x + f(b, y) + a```

Also, setting the option `inflag` to `true` and calling `part` or `substpart` is the same as calling `inpart` or `substinpart`.

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

### Related Examples

a(x):=b*x+c;

a(x);

b:2;

Calculate

##### substpart

substpart ("[", 9/x, 0);

Calculate

? substpart;

Calculate

##### substpart

a: 1/(x^2 + 2);

substpart (x, a, 2);

Calculate

f1: 9/x;

f2: 4*%e^(3*x);

f3: 4*x^6;

Calculate

##### substpart

a: x*(x^2-x_0^2);

substpart (x_0, a, 2,...

Calculate

##### substpart

a(x):=b*x+c;

a(x);

d(b,x):=substpart("+"...

Calculate

##### substpart

substpart("(",a+b*(a+...

a+c+b*c+c*d+e+f+g+h+i...

["+",a,b];

Calculate

a(x):=b*x+c;

a(x);

b:2;

Calculate

##### substpart

a: 1/(x^2 + 2);

substpart (x, a, 2, 1...

Calculate