# How to implement split-complex numbers?

For those who do not know, the split-complex numbers are an analogue to the complex numbers where J is defined such that $$J^2=1$$ but $$J\ne\pm1$$, so they are all of the form $$a+bJ$$.

By using TagSetDelayed, I tried to define the split-complex numbers as so:

J /: J^2 := 1


If I then type J^2, I get the output 1. However, if I type J^3, I just get the output J^3. I would like to instead get the output $$J$$, since $$J^3=J^2J=1J=J$$. Is there a better way to implement this number system?

• Might be easier to do this using 2x2 matrix representations. – Daniel Lichtblau Jan 22 at 22:28
• Ummmm.... isn't $J = -1$? – David G. Stork Jan 22 at 23:28
• Sorry, I forgot to specify that $J\ne -1$ either, I've edited the question to fix that – volcanrb Jan 22 at 23:46

J /: Power[J, p_Integer?OddQ] := J