My equations contain different cases which differ only by some signs. So in order to work with all cases simultaneously, I introduce a placeholder for a sign:
s[x]
where x labels which sign that is. Now when I perform manipulations of my terms, I encounter higher powers of the same sign, like s[1]^2. Of course the square of a sign should be just s[1]^2=1, so I try to define a rule:
s[x_]^2:=1
SetDelayed::write: Tag Power in s[x_]^2 is Protected.
As you can see, there is an error message and the rule does not get set. How should I be going about defining a rule that sets the square of any s[x] to 1?
s /: s[x_]^n_Integer /; n > 1 := s[x]^Mod[n, 2]. – Kagaratsch May 19 '17 at 18:43