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

Algebra Calculator

#### Substinpart

Function: substinpart (<x>, <expr>, <n_1>, ..., <n_k>) Similar to `substpart`, but `substinpart` works on the internal representation of <expr>.

Examples:

```          (%i1) x . diff (f(x), x, 2);
2
d
(%o1)                   x . (--- (f(x)))
2
dx
(%i2) substinpart (d^2, %, 2);
2
(%o2)                        x . d
(%i3) substinpart (f1, f[1](x + 1), 0);
(%o3)                       f1(x + 1)```

If the last argument to a `part` function is a list of indices then several subexpressions are picked out, each one corresponding to an index of the list. Thus

```          (%i1) part (x + y + z, [1, 3]);
(%o1)                         z + x```

`piece` holds the value of the last expression selected when using the `part` functions. It is set during the execution of the function and thus may be referred to in the function itself as shown below. If `partswitch` is set to `true` then `end` is returned when a selected part of an expression doesnt exist, otherwise an error message is given.

```          (%i1) expr: 27*y^3 + 54*x*y^2 + 36*x^2*y + y + 8*x^3 + x + 1;
3         2       2            3
(%o1)     27 y  + 54 x y  + 36 x  y + y + 8 x  + x + 1
(%i2) part (expr, 2, [1, 3]);
2
(%o2)                         54 y
(%i3) sqrt (piece/54);
(%o3)                        abs(y)
(%i4) substpart (factor (piece), expr, [1, 2, 3, 5]);
3
(%o4)               (3 y + 2 x)  + y + x + 1
(%i5) expr: 1/x + y/x - 1/z;
1   y   1
(%o5)                      - - + - + -
z   x   x
(%i6) substpart (xthru (piece), expr, [2, 3]);
y + 1   1
(%o6)                       ----- - -
x     z```

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

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

? substinpart;

Calculate

? substinpart;

Calculate