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

Algebra Calculator

#### Equiv_classes

Function: equiv_classes (<s>, <F>) Returns a set of the equivalence classes of the set <s> with respect to the equivalence relation <F>.

<F> is a function of two variables defined on the Cartesian product of <s> with <s>. The return value of <F> is either `true` or `false`, or an expression <expr> such that `is(<expr>)` is either `true` or `false`.

When <F> is not an equivalence relation, `equiv_classes` accepts it without complaint, but the result is generally incorrect in that case.

Examples:

The equivalence relation is a lambda expression which returns `true` or `false`.

```          (%i1) equiv_classes ({1, 1.0, 2, 2.0, 3, 3.0},
lambda ([x, y], is (equal (x, y))));
(%o1)            {{1, 1.0}, {2, 2.0}, {3, 3.0}}```

The equivalence relation is the name of a relational function which `is` evaluates to `true` or `false`.

```          (%i1) equiv_classes ({1, 1.0, 2, 2.0, 3, 3.0}, equal);
(%o1)            {{1, 1.0}, {2, 2.0}, {3, 3.0}}```

The equivalence classes are numbers which differ by a multiple of 3.

```          (%i1) equiv_classes ({1, 2, 3, 4, 5, 6, 7},
lambda ([x, y], remainder (x - y, 3) = 0));
(%o1)              {{1, 4, 7}, {2, 5}, {3, 6}}```

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

### Related Examples

##### equiv_classes-integerp-is-lambda

equiv_classes ({0, 1....

Calculate

##### equiv_classes-integerp-is-lambda

equiv_classes ({1, 1....

Calculate

##### equiv_classes-lambda-remainder

equiv_classes ({1, 2,...

Calculate

##### equiv_classes-lambda-remainder

equiv_classes({1,2,3,...

Calculate

##### equiv_classes-integerp-is-lambda

equiv_classes ({1, 1....

Calculate

##### equiv_classes-lambda-remainder

equiv_classes ({1, 2,...

Calculate

##### equiv_classes-integerp-is-lambda

equiv_classes ({1, 1....

Calculate

? equiv_classes;

Calculate

##### equiv_classes-integerp-is-lambda-mod

equiv_classes ({1, 1....

Calculate

##### equiv_classes-is-lambda

equiv_classes ({1, 1....

Calculate