0
$\begingroup$

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

$\endgroup$
2
  • 6
    $\begingroup$ How to write a good question! $\endgroup$
    – halirutan
    Commented Jan 25, 2013 at 15:20
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Jan 26, 2013 at 22:33

2 Answers 2

6
$\begingroup$
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]];
$\endgroup$
0
$\begingroup$

Add this line to the top of the notebook:

$Post = #/.J->{-1,1}/.{x_,y_}->(x+y)/2+J(y-x)/2&;

Use like this:

In:= Log[J]

Out:= (I Pi)/2 - (I Pi J)/2

In:= (3J+5)^3

Out:= 260 + 252 J

In:= I^J

Out:= I J
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.