Creates a higher dimensional number from its components. For end users it is recommended that they use the BigNum.real, BigNum.complex and BigNum.hyper functions to create new numbers.
The components of the number.
Creates a higher dimensional number from its components. For end users it is recommended that they use the BigNum.real, BigNum.complex and BigNum.hyper functions to create new numbers.
The components of the number.
The components of the number represented by this object. The first one (at index 0) is the real component and the rest are the components of the imaginary units.
The dimension in which this number belongs. The dimension must always be a power of 2.
The conjugate of this
number.
The imaginary part of this number.
The negative of this
.
The real part of this number.
Adds two BigNum instances. Addition is defined component-wise. That is, for two numbers \( a \) and \( b \), their addition is defined as
\[ a + b = \sum_i a_i + b_i \]
The result is rounded according to mathenv.mode.
The number to add this with.
this + that.
Adds two BigNum instances. Addition is defined component-wise. That is, for two numbers \( a \) and \( b \), their addition is defined as
\[ a + b = \sum_i a_i + b_i \]
The result is rounded according to the given context settings.
The number to add this with.
The context settings to use.
this + that.
Divides one BigNum instance by another. This method assumes right
division. That is, the inverse of that
is multiplied on the right.
The result is rounded according to mathenv.mode.
Number to divide by.
Divides one BigNum instance by another. This method assumes right
division. That is, the inverse of that
is multiplied on the right.
The result is rounded according to the given context settings.
Number to divide by.
The context settings to use.
Divides one BigNum instance by another. This method multiplies the
inverse of that
on the given "side" of this
.
The result is rounded according to mathenv.mode.
Number to divide by.
Side on which to divide from.
Divides one BigNum instance by another. This method multiplies the
inverse of that
on the given "side" of this
.
The result is rounded according to the given context settings.
Number to divide by.
Side on which to divide from.
The context settings to use.
Checks whether this
and that
are equal numbers. Equality is defined
component wise. That is, two numbers \( a \) and \( b \) are equal
if and only if
\[ a_i = b_i \quad \forall i \]
The equality is checked only up to the number of decimal places specified by mathenv.mode.
The number to check against.
Checks whether this
and that
are equal numbers. Equality is defined
component wise. That is, two numbers \( a \) and \( b \) are equal
if and only if
\[ a_i = b_i \quad \forall i \]
The equality is checked only up to the number of decimal places specified by the given context settings.
The number to check against.
The context settings to use.
Checks whether a method exists on the object or as a static member of the class.
Name of the method.
Calculates the multiplicative inverse of this. The result is rounded according to mathenv.mode.
Calculates the multiplicative inverse of this. The result is rounded according to the given context.
Multiplies two BigNum instances. Multiplication is defined using the Cayley-Dickson definition. The result is rounded according to mathenv.mode.
The number to multiply with.
this * that.
Multiplies two BigNum instances. Multiplication is defined using the Cayley-Dickson definition. The result is rounded according to the given context settings.
The number to multiply with.
The context settings to use.
this * that.
Evaluates the norm of this number. Since this
is not necessarily a real
number, the norm is defined as
\[ \text{norm } a = a^* a \]
where \( a^* \) is the conjugate of \( a \).
The norm is calculated with rounding according to mathenv.mode.
Evaluates the norm of this number. Since this
is not necessarily a real
number, the norm is defined as
\[ \text{norm } a = a^* a \]
where \( a^* \) is the conjugate of \( a \).
The norm is calculated with rounding according to the given context.
The context settings to use.
Subtracts one BigNum instance from another. Subtraction is defined component-wise. That is, for two numbers \( a \) and \( b \), their difference is defined as
\[ a - b = \sum_i a_i - b_i \]
The result is rounded according to mathenv.mode.
The number to add this with.
this - that.
Subtracts one BigNum instance from another. Subtraction is defined component-wise. That is, for two numbers \( a \) and \( b \), their difference is defined as
\[ a - b = \sum_i a_i - b_i \]
The result is rounded according to the given context settings.
The number to add this with.
this - that.
Evaluates the absolute value of a number correct up to the number of places specified by mathenv.mode.
A number.
Evaluates the absolute value of a number correct up to the number of places specified by the given context settings.
A number.
The context settings to use.
Evaluates the absolute value of a number correct up to the number of places specified by mathenv.mode.
A number.
Evaluates the absolute value of a number correct up to the number of places specified by the given context settings.
A number.
Context settings to use.
Calculates the inverse trigonometric cosine of a given value with rounding according to mathenv.mode.
Method:
\[ \cos^{-1} (a + v) = \cos^{-1} \left( \frac{\alpha(a, \theta) - \beta(a, \theta)}{2} \right) - \hat{v} \cosh^{-1} \left( \frac{\alpha(a, \theta) + \beta(a, \theta)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
Calculates the inverse trigonometric cosine of a given value with rounding according to the given context settings.
Method:
\[ \cos^{-1} (a + v) = \cos^{-1} \left( \frac{\alpha(a, \theta) - \beta(a, \theta)}{2} \right) - \hat{v} \cosh^{-1} \left( \frac{\alpha(a, \theta) + \beta(a, \theta)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
The context settings to use.
Calculates the inverse hyperbolic cosine of a given value with rounding according to mathenv.mode.
Method:
\[ \cosh^{-1} (a + v) = \cosh^{-1} \left( \frac{\alpha(\theta, a) + \beta(\theta, a)}{2} \right) + \hat{v} \cos^{-1} \left( \frac{\alpha(\theta, a) - \beta(\theta, a)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
Calculates the inverse hyperbolic cosine of a given value with rounding according to the given context settings.
Method:
\[ \cosh^{-1} (a + v) = \cosh^{-1} \left( \frac{\alpha(\theta, a) + \beta(\theta, a)}{2} \right) + \hat{v} \cos^{-1} \left( \frac{\alpha(\theta, a) - \beta(\theta, a)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
The context settings to use.
Calculates the inverse trigonometric sine of a given value with rounding according to mathenv.mode.
Method:
\[ \sin^{-1} (a + v) = \sin^{-1} \left( \frac{\alpha(a, \theta) - \beta(a, \theta)}{2} \right) + \hat{v} \cosh^{-1} \left( \frac{\alpha(a, \theta) + \beta(a, \theta)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
Calculates the inverse trigonometric sine of a given value with rounding according to the given context settings.
Method:
\[ \sin^{-1} (a + v) = \sin^{-1} \left( \frac{\alpha(a, \theta) - \beta(a, \theta)}{2} \right) + \hat{v} \cosh^{-1} \left( \frac{\alpha(a, \theta) + \beta(a, \theta)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
The context settings to use.
Calculates the inverse hyperbolic sine of a given value with rounding according to mathenv.mode.
Method:
\[ \sinh^{-1} (a + v) = \cosh^{-1} \left( \frac{\alpha(\theta, a) + \beta(\theta, a)}{2} \right) + \hat{v} \sin^{-1} \left( \frac{\alpha(\theta, a) - \beta(\theta, a)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
Calculates the inverse hyperbolic sine of a given value with rounding according to the given context settings.
Method:
\[ \sinh^{-1} (a + v) = \cosh^{-1} \left( \frac{\alpha(\theta, a) + \beta(\theta, a)}{2} \right) + \hat{v} \sin^{-1} \left( \frac{\alpha(\theta, a) - \beta(\theta, a)}{2} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta.
A number.
The context settings to use.
Calculates the inverse trigonometric tangent of a given value with rounding according to mathenv.mode.
Method:
\[ \tan^{-1}(a+v) = \frac{1}{2} \tan^{-1} \left( \frac{2a}{1 - \lVert a+v \rVert} \right) + \hat{v} \frac{1}{4} \ln \left( \frac{\alpha^2(\theta, a)}{\beta^2(\theta, a)} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta and \( \lVert a+v \rVert \) is the norm of the argument.
A number.
Calculates the inverse trigonometric tangent of a given value with rounding according to the given context settings.
Method:
\[ \tan^{-1}(a+v) = \frac{1}{2} \tan^{-1} \left( \frac{2a}{1 - \lVert a+v \rVert} \right) + \hat{v} \frac{1}{4} \ln \left( \frac{\alpha^2(\theta, a)}{\beta^2(\theta, a)} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta and \( \lVert a+v \rVert \) is the norm of the argument.
A number.
The context settings to use.
Calculates the inverse hyperbolic tangent of a given value with rounding according to mathenv.mode.
Method:
\[ \tanh^{-1} (a + v) = \frac{1}{4} \ln \left( \frac{\alpha^2(a, \theta)}{\beta^2(a, \theta)} \right) +\hat{v} \frac{1}{2} \tan^{-1} \left( \frac{2\theta}{1 - \lVert a+v \rVert} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta and \( \lVert a+v \rVert \) is the norm of the argument.
A number.
Calculates the inverse hyperbolic tangent of a given value with rounding according to the given context settings.
Method:
\[ \tanh^{-1} (a + v) = \frac{1}{4} \ln \left( \frac{\alpha^2(a, \theta)}{\beta^2(a, \theta)} \right) +\hat{v} \frac{1}{2} \tan^{-1} \left( \frac{2\theta}{1 - \lVert a+v \rVert} \right) \]
where \( \alpha(x, y) \) and \( \beta(x, y) \) are defined by the function alpha_beta and \( \lVert a+v \rVert \) is the norm of the argument.
A number.
The context settings to use.
Creates a BigNum instance of a complex number from the decimal representations
of the real and imaginary part. This instance will store the exact binary
floating point value of the number. Even though it uses the toString()
method to convert number to string it might be unpredictable at times.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
The real part of the number.
The imaginary part of the number.
Creates a BigNum instance from the string representations of the real and imaginary parts.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
The real part of the number.
The imaginary part of the number.
Calculates the trigonometric cosine of a given number with rounding according to mathenv.mode.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \cos (a + v) = \cos a \cosh \theta - \hat{v} \sin a \sinh \theta \]
A number.
Calculates the trigonometric cosine of a given number with rounding according to the given context settings.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \cos (a + v) = \cos a \cosh \theta - \hat{v} \sin a \sinh \theta \]
A number.
The context settings to use.
Calculates the hyperbolic cosine of a given value with rounding according to mathenv.mode.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \cosh (a + v) = \cosh a \cos \theta + \hat{v} \sinh a \sin \theta \]
A number.
Calculates the hyperbolic cosine of a given value with rounding according to the given context settings.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \cosh (a + v) = \cosh a \cos \theta + \hat{v} \sinh a \sin \theta \]
A number.
The context settings to use.
Returns a single unit corresponding to a given index. The indexing starts from 0. With \( e_0 = 1 \) defined as the real unit and the rest (for \( i>0 \)) are the orthogonal imaginary units.
The index.
Calculates the exponential of a given number with rounding according to mathenv.mode.
A number.
Calculates the exponential of a given number with rounding according to the given context settings.
A number
The context settings to use.
Creates a BigNum instance from the components of a hyper-complex
number that follow the Cayley-Dickson construction.
This instance will use the exact binary floating point representations
of the components. Even though it uses the toString()
method to convert
numbers to strings it might be unpredictable at times.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
The components of the number.
Creates a BigNum instance from the components of a hyper-complex
number that follow the Cayley-Dickson construction.
This instance will use the exact binary floating point representations
of the components. Even though it uses the toString()
method to convert
numbers to strings it might be unpredictable at times.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
The components of the number.
Creates a BigNum instance from the components of a hyper-complex number that follow the Cayley-Dickson construction.
The components of the number.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
Creates a BigNum instance from the components of a hyper-complex number that follow the Cayley-Dickson construction.
The components of the number.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
Calculates the natural logarithm (to the base \( e \)) of a given number with rounding according to mathenv.mode.
Method:
Let \( r \) be the absolute value of \( x \). Therefore, \( r = \lvert a + \hat{v} \theta \rvert \).
\[ \ln \left(a+\hat{v}\theta \right) = \ln r + \hat{v} \phi \]
where \( \phi \) is such that
\[ \begin{align} a &= r \cos \phi \\ \theta &= r \sin \phi \end{align} \]
that is,
\[ \phi = \operatorname{atan2} \left(\theta, a \right) \]
A number.
Calculates the natural logarithm (to the base \( e \)) of a given number with rounding according to the given context settings.
Method:
Let \( r \) be the absolute value of \( x \). Therefore, \( r = \lvert a + \hat{v} \theta \rvert \).
\[ \ln \left(a+\hat{v}\theta \right) = \ln r + \hat{v} \phi \]
where \( \phi \) is such that
\[ \begin{align} a &= r \cos \phi \\ \theta &= r \sin \phi \end{align} \]
that is,
\[ \phi = \mathrm{atan2} \left(\theta, a \right) \]
A number.
The context settings to use.
Creates a BigNum instance from the string representation of a real number.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
The string representation of a real number in decimal system.
Creates a BigNum instance from the decimal representation of a real
number. This instance created will store the exact binary floating
point value of the number. Even though it uses the toString()
method
to convert the number to a string it might be unpredictable at times.
The use of this function to create a new BigNum instance is recommended over using the constructor for the same. The constructor may not always be predictable is called directly.
A numeric expression.
Rounds off a BigNum instance, component-wise, according to some MathContext. The different rounding algorithms implemented are heavily influenced by the Java implementation of the same.
The number to be rounded off.
The context settings to use for rounding.
Calculates the trigonometric sine of a given number with rounding according to mathenv.mode.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \sin (a + v) = \sin a \cosh \theta + \hat{v} \cos a \sinh \theta \]
A number.
Calculates the trigonometric sine of a given number with rounding according to the given context settings.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \sin (a + v) = \sin a \cosh \theta + \hat{v} \cos a \sinh \theta \]
A number.
The context settings to use.
Calculates the hyperbolic sine of a given value with rounding according to mathenv.mode.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \sinh (a + v) = \sinh a \cos \theta + \hat{v} \cosh a \sin \theta \]
A number.
Calculates the hyperbolic sine of a given value with rounding according to the given context settings.
Method:
The sum formula works for higher dimensional numbers too. Therefore,
\[ \sinh (a + v) = \sinh a \cos \theta + \hat{v} \cosh a \sin \theta \]
A number.
The context settings to use.
Calculates the trigonometric tangent of a given number with rounding according to mathenv.mode.
A number.
Calculates the trigonometric tangent of a given number with rounding according to the given context settings.
A number.
The context settings to use.
Calculates the hyperbolic tangent of a given value with rounding according to mathenv.mode.
Method:
The easiest way to calculate \( \tanh x \) is to use
\[ \tanh (a+v) = \frac{\sinh (a+v)}{\cosh (a+v)} \]
Upon simplifying,
\[ \tanh (a + v) = \frac{\sinh 2a}{\cosh 2a + \cos 2\theta} + \hat{v} \frac{\sin 2\theta}{\cosh 2a + \cos 2\theta} \]
A number.
Calculates the hyperbolic tangent of a given value with rounding according to the given context settings.
Method:
The easiest way to calculate \( \tanh x \) is to use
\[ \tanh (a+v) = \frac{\sinh (a+v)}{\cosh (a+v)} \]
Upon simplifying,
\[ \tanh (a + v) = \frac{\sinh 2a}{\cosh 2a + \cos 2\theta} + \hat{v} \frac{\sin 2\theta}{\cosh 2a + \cos 2\theta} \]
A number.
The context settings to use.
Generated using TypeDoc
Immutable, arbitrary precision, higher dimensional numbers. A BigNum consists of a real part and imaginary part(s) stored as Component objects. A MathContext object is used to specify the number of decimal places (not significant figures) the user wants and what rounding algorithm should be used. Every operation is carried out by an intermediate result which is then rounded to the preferred number of decimal places using the preferred rounding algorithm.
The BigNum objects follow the Cayley-Dickson construction algebra for multiplication. They can be mathematically expressed as
\[ x = \sum_{i=0}^{N-1} x_ie_i \]
where \( N \) represents the number of dimensions the number exists in and \( e_i \) are the orthogonal units. The components are stored using a real first convention. Therefore, by convention \( e_0 = 1 \), the real unit. The others are the imaginary units. The \( e_1 \) is our familiar \( \imath \) for the complex numbers. Again, \( e_2=\jmath \) and \( e_3=k \) are the Hamilton's units for quaternions.
In the documentation for the methods below, unless otherwise stated, the following notation is used.
Let \( x = a + v \) where \( a \) is the real part and \( v \) is the "vector" part or the purely imaginary part. Define \( \hat{v} = \frac{v}{\lvert v \rvert} \) and \( \theta = \lvert v \rvert \) such that \( x = a + \hat{v} \theta \).