Mathematica Asked by volcanrb on September 5, 2021
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 $Jnepm1$, 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?
Try this:
J /: Power[J, p_Integer?OddQ] := J
J /: Power[J, p_Integer?EvenQ] := 1
J^Range[-10, 10]
{1, J, 1, J, 1, J, 1, J, 1, J, 1, J, 1, J, 1, J, 1, J, 1, J, 1}
Correct answer by Henrik Schumacher on September 5, 2021
You can represent split-complex numbers as multivectors (geometric number, clifford number) with signature $(1, 0)$. I have a paclet for this:
PacletInstall["https://wolfr.am/OkONsyY2"]
<< GeometricAlgebra`
(* this is your split-complex number *)
h = Multivector[{a, b}, 1]
(* you can perform numeric operations with it *)
h^2
h^-1
MultivectorFunction[Exp, h] (* similar to MatrixFunction *)
Answered by swish on September 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP