Hi Jean, thanks for your interest in Maxima.
On 2012-04-16, Jean Vittor <jean.vittor at free.fr> wrote:
> (%i1) matchdeclare(e, lambda([e],equal(abs(e), 1)));
I guess to be pedantic we should narrow this to +1 or -1.
(the rule won't apply if imaginary part != 0, right?)
> (%i2) matchdeclare(n, integer);
Unfortunately to specify that n is an integer is a little
clumsy. Maxima's integerp isn't enough either (it only
detects literal integers). Also I think we need to specify
that n isn't in {0, 1}, otherwise we'll get an infinite
loop in the rule.
Here is an example which seems to work OK.
matchdeclare (ee, lambda ([e], featurep (e, integer) and equal (abs (e), 1)));
matchdeclare (nn, lambda ([e], featurep (e, integer) and e > 1));
tellsimp (ee^nn, ee^(mod (nn, 2)));
declare (e1, integer);
assume (equal (abs (e1), 1));
Then
e1^17;
=> e1
e1^16;
=> 1
declare (m, integer);
e1^m;
=> e1^m
assume (m > 1);
e1^m;
=> e1^(mod(m, 2))
Oops, I put e > 1 in the matchdeclare for nn -- that's
not equivalent to e not in {0, 1} if e is negative. Rats.
HTH
Robert Dodier