perplex_num
Overview
perplex_num
is a Rust crate that provides an implementation of perplex numbers, based on the numerical abstractions of the num_traits crate. This library supports various mathematical functions such as pow
, sqrt
, exp
, ln
, sinh
, sin
, cosh
, and tan
. Additionally, the crate offers a hyperbolic polar form for representing and manipulating numbers in the hyperbolic plane, as well as a matrix form representation feature based on nalgebra.
For an in-depth explanation (including visualizations) of perplex numbers and how they integrate with the crate's modules, see the Perplex Number Description in the repository.
Features
- The
Perplex
struct is equipped with a comprehensive set of common mathematical operations, courtesy ofstd::ops
andnum_traits
. - Emulating the functionality of
nalgebra::Complex
, thePerplex
struct mirrors most functions found in the num_complex crate, maintaining consistent naming conventions. - It supports the hyperbolic polar form across all sectors of the plane.
- The matrix representation feature is based upon the robust foundation of nalgebra::Matrix.
Usage
Installation
cargo add perplex_num
or add this to Cargo.toml
:
[]
= "0.1"
The matrix
feature is enabled by default, which adds the nalgebra
crate as a dependency. This can be disabled with:
[]
= "0.1"
= false
Examples
The examples
directory contains various practical demonstrations of how to use the perplex_num
crate. These examples not only illustrate the usage of perplex numbers but also show how to produce visualizations as seen in the Perplex Number Description.
For instance, examples/visualize_functions.rs
is executed by the following command:
This will generate an image that depicts the behavior of functions like sinh
, cos
, inv
, and exp
when applied to perplex numbers.
Creating a Perplex Number and Performing Operations
Here's a quick example of how to get started with creating a perplex number and performing basic operations:
use Perplex;
Coverage
Test coverage report is generated with cargo tarpaulin. Invoke it with:
Compatibility
The perplex_num
crate is tested for rustc 1.76.
Bibliography
- The Mathematics of Minkowski Space-Time
- Hyperbolic trigonometry in two-dimensional space-time geometry
- Fundamental Theorems of Algebra for the Perplexes
- Introduction to Hybrid Numbers
- New characterizations of the ring of the split-complex numbers and the field C of complex numbers and their comparative analyses