Perplex numbers, also known as split-complex, double or hyperbolic numbers, are an extension of the real numbers
perplex: Defines thePerplexstruct and associated methods such as hyperbolic trigonometric functions.polar: Contains theHyperbolicPolarandHyperbolicSectortypes for representation in hyperbolic polar coordinates.binary_ops: Implements binary operations like addition and multiplication.single_ops: Provides single operand operations like negation, inversion and exponentiation.matrix: (Optional feature) Implements matrix forms and operations for hyperbolic numbers.
The perplex numbers form an algebraic ring with addition and multiplication (see Wikipedia for a definition in terms of abstract algebra). Let
-
Addition is component-wise:
$$z_1+z_2 = (t_1+t_2) + (x_1+x_2)h$$ -
Multiplication is given by:
$$z_1 z_2 = (t_1t_2 + x_1x_2 ) + (t_2x_1 + t_1x_2)$$
Let
-
Conjugate of a perplex number is:
$$\bar z = t - xh$$ -
Squared Distance is defined by the quadratic form
$D$ , and can be negative:$$D(z)=z\bar z = t^2-x^2$$ -
Modulus (magnitude) is the square root of the absolute value of
$D(z)\in \mathbb R $ :$$\vert z \vert = \sqrt{\vert D(z) \vert}$$ -
Inverse
$z^{-1}=\frac{1}{z}$ is the perplex number that multiplies to the neutral element of multiplication ($zz^{-1}=1$ ). It is given by:$$z^{-1}=\frac{\bar z}{D(z)}=\frac{t - xh}{t^2-x^2}$$
Perplex numbers include elements called null vectors or zero divisors, which are of the form
The hyperbolic plane can be divided into four distinct sectors by the intersection of two diagonals,
-
Right Sector: This sector is defined by the condition
$( t > |x| )$ . It lies to the right of both diagonals and represents the region where the time component is greater than the space component in absolute value. -
Up Sector: Located above the diagonal
$( t = x )$ and to the left of the diagonal$( t = -x )$ , the up sector is characterized by$( x > |t| )$ , indicating that the space component is greater than the time component in absolute value. -
Left Sector: The left sector is the mirror image of the right sector, lying to the left of both diagonals. It is defined by
$( -t > |x| )$ , where the negative time component is greater in magnitude. -
Down Sector: This sector is the mirror image of the up sector, defined by
$( -x > |t| )$ .
These sectors are important in the study of hyperbolic geometry and perplex numbers, as they determine the nature of the functions and operations that can be performed within each region. Certain functions may only be well-defined or invertible in specific sectors of the hyperbolic plane. The square root of a perplex number, for instance, is only defined within the right sector.
The common categorization of perplex numbers is based on the squared distance. A number is:
-
time-like if D(z) > 0, i.e., it lies in the Right
$(t>|x|)$ or Left$(-t>|x|)$ sector -
space-like if D(z) < 0, i.e., it lies in the Up
$(x>|t|)$ or Down$(-x>|t|)$ sector -
light-like if D(z) = 0, i.e., it lies on one of the diagonals
$(t=x)$ or$(t=-x)$
The inversion of a perplex number, for instance, is only defined for time- or space-like numbers, more info at Fundamental Theorems of Algebra for the Perplexes.
In the context of perplex numbers, the Klein group
- The identity element 1 leaves a perplex number in the same sector.
- The element h acts as a mirror along the diagonals, effectively flipping the time and space components. For instance, it maps right to up.
- The element -1 represents a vertical and horizontal mirror, changing the sign of both components. It maps up to down and right to left.
- The element -h combines the effects of h and -1. An interesting feature of the Klein group is that each element is its own multiplicative inverse. More infos about the sectors and the Klein group can be found in Tab. 1 and Appendix B of Hyperbolic trigonometry in two-dimensional space-time geometry
Building upon the foundational operations such as addition and multiplication, the perplex_num crate includes a variety of functions tailored for perplex numbers. Most of the functions are implemented to operate over the complete hyperbolic plane.
The accompanying image provides a graphical representation of a subset of these functions, tracing their behavior across a portion
Multiplication by elements of the Klein group allows for the mapping of a perplex number from its original sector to another. This property is utilized in the implementation of functions like the exponential (exp) and natural logarithm (ln) to ensure consistency across the entire plane. For instance, to compute the exponential of a perplex number, the number is first mapped to the Right Sector, exp is applied, and then the result is mapped back to the original sector using the same element (which is the inverse). This approach guarantees that ln is the inverse of exp and vice versa.
The perplex_num crate provides the HyperbolicPolar struct for representing perplex numbers in a hyperbolic sector by means of an angle and a distance, as well as a symmetric matrix form with
The hyperbolic polar form is expressed as
The argument function is derived from Eq. 4.1.6 in Section 4.1.1 "Hyperbolic Exponential Function and Hyperbolic Polar Transformation" in The Mathematics of Minkowski Space-Time. Lines HyperbolicPolar struct is implemented based on an extended version of Formula 4.6 from the same literature, ensuring a consistent approach across the entire plane.
The accompanying images illustrate the mapping of the hyperbola
In matrix form, a perplex number
This representation aligns with standard matrix operations, where addition and multiplication correspond to their matrix counterparts.
The benches directory contains a Criterion suite of benchmarks designed to evaluate the performance of various exponentiation methods for perplex numbers. These methods include:
- Naive Loop: This method involves straightforward repeated multiplication of the perplex number by itself.
- Squaring: A more sophisticated algorithm that minimizes the number of multiplications through exponentiation by squaring.
- Matrix Form: This approach leverages the matrix representation of perplex numbers for exponentiation.
- Polar Form: Focusing on the hyperbolic polar form, this method is central to the benchmarks and may offer efficiency gains for large exponents.
The benchmarking results have informed the implementation of the Pow<u32> trait for the Perplex struct, favoring the exponentiation by squaring algorithm for its efficiency.


