# Hyperbolic numbers and their polar form

How can I implement Hyperbolic numbers in Mathematica? How could I express their polar form? How could I calculate their power?

-
How to write a good question! – halirutan Jan 25 '13 at 15:20
Depends on what exactly you want to do with them. For the "standard" case x+j*y with j^2=1, could use symmetric 2x2 matrices. – Daniel Lichtblau Jan 26 '13 at 22:33

ScalarQ[c_] := NumericQ[c] && ! MatchQ[Head[c], Complex | Hyperbolic];

Hyperbolic /: Hyperbolic[a_, 0] := a;

Hyperbolic /: c_?ScalarQ + Hyperbolic[a_, b_] := Hyperbolic[c + a, b];

Hyperbolic /: Hyperbolic[a_, b_] + Hyperbolic[c_, d_] :=
Hyperbolic[a + c, b + d];

Hyperbolic /: c_?ScalarQ*Hyperbolic[a_, b_] /; ScalarQ[c] :=
Hyperbolic[c a, c b];

Hyperbolic /: Hyperbolic[a_, b_]*Hyperbolic[c_, d_] :=
Hyperbolic[a c + b*d, b c + a d];

Hyperbolic /: Power[Hyperbolic[a_, b_], 0] := 1;

Hyperbolic /: Power[Hyperbolic[a_, b_], -1] :=
Hyperbolic[a/(a^2 - b^2), -b/(a^2 - b^2)];

Hyperbolic /: Power[Hyperbolic[a_, b_], n_Integer?Positive] :=
Hyperbolic[a, b] Power[Hyperbolic[a, b], n - 1];

Hyperbolic /: Power[Hyperbolic[a_, b_], n_Integer?Negative] :=
1/Power[Hyperbolic[a, b], -n];

Hyperbolic /: Power[Hyperbolic[a_, b_], x_?ScalarQ] :=
Which[a^2 - b^2 > 1,
Hyperbolic[(Sqrt[Abs[a^2 - b^2]])^x*
Cosh[x*ArcTan[b/a]], (Sqrt[Abs[a^2 - b^2]])^x*
Sinh[x*ArcTan[b/a]]], a^2 - b^2 < -1,
Hyperbolic[(Sqrt[Abs[a^2 - b^2]])^x*
Sinh[x*ArcTan[b/a]], (Sqrt[Abs[a^2 - b^2]])^x*
Cosh[x*ArcTan[b/a]]], a^2 - b^2 == 0, 0];

Hyperbolic /:
f_[Hyperbolic[a_, b_]] /; MemberQ[Attributes[f], NumericFunction] :=
Hyperbolic[f[a], b f'[a]];

-