Sponsored links: Algebra eBooks

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

Algebra Calculator

#### Part

Function: part (<expr>, <n_1>, ..., <n_k>) Returns parts of the displayed form of `expr`. It obtains the part of `expr` as specified by the indices <n_1>, ..., <n_k>. First part <n_1> of `expr` is obtained, then part <n_2> of that, etc. The result is part <n_k> of ... part <n_2> of part <n_1> of `expr`. If no indices are specified `expr` is returned.

`part` can be used to obtain an element of a list, a row of a matrix, etc.

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 `part (x + y + z, [1, 3])` is `z+x`.

`piece` holds 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.

See also `inpart`, `substpart`, `substinpart`, `dpart`, and `lpart`.

Examples:

```          (%i1) part(z+2*y+a,2);
(%o1)                                 2 y
(%i2) part(z+2*y+a,[1,3]);
(%o2)                                z + a
(%i3) part(z+2*y+a,2,1);
(%o3)                                  2```

`example (part)` displays additional examples.

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

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

### Related Examples

##### part-rat

p(z):= a*z^2+b;

q(z):= c*z^2+d;

nxt(ns) := rat(ns[1]^...

Calculate

part((a+b),1);

Calculate

##### part

part(3*x*(x+5),0);

part(-3*x*(x+5),0);

part(x*(-3*x-15),0);

Calculate

##### part-random-substpart

signs:["+","-","*","/"];

a1:random(8);

a2:random(5);

Calculate

##### part-solve

e1:ib = s*Cpi*(vb-ve);

e2:s*Cpi*(vb-ve) + gm...

part(solve([e1,e2],[i...

Calculate

##### part

part((x+3)^2*x, 2);

Calculate

answer:x=6;

part(answer,2);

Calculate

##### part-solve

eq1:r1^2=x^2+(z-e)^2;

solve([eq1],[x]);

solve([eq1],[z]);

Calculate

##### part-solve

answer: solve(x^2=1);

part(answer,1);

part(answer,2);

Calculate

##### part

answer: (x+1)*(x-2)=0;

aa : part(answer,1);

part(aa,0);

Calculate