# [Maxima] probleme with rule

Robert Dodier robert.dodier
Sun Oct 8 12:52:45 CDT 2006

```Laurent,

> I try to solve a system of equations including binary variables
> and non binary variables. To this end I wish to say to Maxima that:
> For all binary variable b and for any integer n > 0
> b^n = b

An interesting problem, thanks for suggesting it. Here is a possible solution.

declare (binary, feature);
matchdeclare (b, atom, n, integerp);
binary_power (b, n) := if n > 0 and featurep (b, binary) then b else b ^ n;
tellsimpafter (b ^ n, binary_power (b, n));

declare (a1, binary);
a1 ^ 2;
=> a1
a1 ^ 3 + a2 ^ 3;
=> a2^3 + a1

I didn't try other examples.

Notes:
(1) Use declare/featurep instead of put/get here.
Minuscule letters + underscore is customary in the existing Maxima scripts.
(3) Probably the right way to solve this problem is to define a
group with elements 0 and 1 and then declare a to be an element
of that group. I hope Maxima will be able to handle that in the
future (to the best of my knowledge, it is not possible now).

> PS: i noticed that the documentation for the function "get" is under
> "list" subject while the one for function "put" is under "Miscellaneous Options" subject.

Agreed, the documentation is disorganized. I want to organize it
by introducing a category system. I will propose an implementation
in the near future.

All the best
Robert Dodier

```