ca.uwaterloo.alumni.dwharder.Numbers
Class Octonion

java.lang.Object
  extended by ca.uwaterloo.alumni.dwharder.Numbers.Octonion
All Implemented Interfaces:
java.io.Serializable

public final class Octonion
extends java.lang.Object
implements java.io.Serializable

A class implementing octonions using octets of doubles.

This package allows the user to construct, manipulate, and model with octonions. An octonion is of the form a0 + ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7 where each an is a real number. The symbols i, j, k, e', i', j', k' commute with real numbers and obey the multiplication rules i2 = j2 = k2 = e'2 = i'2 = j'2 = k'2 = -1, ij = k, ie' = i', je' = j', ke' = k', and e'e'' = e'''.

Octonions are neither commutative (as they contain the quaternions) nor associative; for example, i'(e j) = k ≠-k = (i'e')j.

In the description of each non-static method, this octonion is represented by o = a0 + ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7. a0 and ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7 are the real and imaginary parts of o, respectively. The real numbers an are the coefficients of the octonion o. The components a0, ia1, ..., k'a7 will be referred to as the 0th, 1st, ..., and 7th terms of the octonion o, respectively.

Any other octonion is represented by p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7. The variables x and n are used to represent real numbers and integers, respectively.

In reference to methods dealing which must deal with branch cuts, the symbol u refers to any unit imaginary octonion (real(u) = 0 and |u| = 1).

Instances of this class are immutable.

This class returns correct answers on branch cuts. Additionally, this class tries to give reasonable treatment to ∞ and NaN. For example, ONE.multiply(Double.POSITIVE_INFINITY) returns ∞ + i0 + ... + k'0. Most implementations would return ∞ + iNaN + ... + k'NaN because they would simply multiply each coefficient by the multiplier. This is probably not the desired result.

This class is based on the methods found in the Java classes Double, Math, and java.math.BigDecimal.

There is very little interaction between between the classes in this package. If there is a significant request for such behaviour, it will be added (seemlessly) in the future.

Since:
JDK 5.0
Version:
1.0beta 22-Mar-2005
Author:
Douglas Wilhelm Harder, Department of Electrical and Computer Engineering, University of Waterloo
See Also:
Double, Math, Serialized Form

Field Summary
static Octonion E1
          The constant e'.
static Octonion I
          The constant i.
static Octonion I1
          The constant i'.
static Octonion J
          The constant j.
static Octonion J1
          The constant j'.
static Octonion K
          The constant k.
static Octonion K1
          The constant k'.
static Octonion NaN
          The constant NaN + iNaN + jNaN + kNaN + e'NaN + i'NaN + j'NaN + k'NaN.
static Octonion ONE
          The constant 1.
static Octonion ZERO
          The constant 0.
 
Constructor Summary
Octonion(double a0)
          Generates the real octonion a0 + i0 + j0 + k0 + e'0 + i'0 + j'0 + k'0.
Octonion(double[] v)
          Generates an octonion based on the entries of the array v.
Octonion(double x, double[] v)
          Generates the octonion x + iv0 + jv1 + kv2 + e'v3 + i'v4 + j'v5 + k'v6.
Octonion(double a1, double a2, double a3, double a4, double a5, double a6, double a7)
          Generates the imaginary octonion 0 + ia1 + ia2 + ia3 + e'a4 + i'a5 + j'a6 + k'a7.
Octonion(double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7)
          Generates the octonion a0 + ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7.
 
Method Summary
 double abs()
          Returns the absolute value of this octonion o.
 double abs2()
          Returns the square of the absolute value of this octonion o.
 double abs2Imag()
          Returns the square of the absolute value of the imaginary part of this octonion o.
 double absImag()
          Returns the absolute value of the imaginary part of this octonion o.
 Octonion acos()
          Returns the principal inverse cosine of this octonion o.
 Octonion acos(Octonion u)
          Returns the principal inverse cosine of this octonion o.
 Octonion acosh()
          Returns the principal inverse hyperbolic cosine of this octonion o.
 Octonion acosh(Octonion u)
          Returns the principal inverse hyperbolic cosine of this octonion o.
 Octonion acot()
          Returns the principal inverse cotangent of this octonion o.
 Octonion acot(Octonion u)
          Returns the principal inverse cotangent of this octonion o.
 Octonion acoth()
          Returns the principal inverse hyperbolic cotangent of this octonion o.
 Octonion acoth(Octonion u)
          Returns the principal inverse hyperbolic cotangent of this octonion o.
 Octonion acsc()
          Returns the principal inverse cosecant of this octonion o.
 Octonion acsc(Octonion u)
          Returns the principal inverse cosecant of this octonion o.
 Octonion acsch()
          Returns the principal inverse hyperbolic cosecant of this octonion o.
 Octonion acsch(Octonion u)
          Returns the principal inverse hyperbolic cosecant of this octonion o.
 Octonion add(double x)
          Returns the sum of this octonion o and the real number x.
 Octonion add(int n, double x)
          Returns this octonion o with x added onto its nth term.
 Octonion add(Octonion p)
          Returns the sum of this octonion o and the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.
 double argument()
          Returns the argument of this octonion o.
 Octonion asec()
          Returns the principal inverse secant of this octonion o.
 Octonion asec(Octonion u)
          Returns the principal inverse secant of this octonion o.
 Octonion asech()
          Returns the principal inverse hyperbolic secant of this octonion o.
 Octonion asech(Octonion u)
          Returns the principal inverse hyperbolic secant of this octonion o.
 Octonion asin()
          Returns the principal inverse sine of this octonion o.
 Octonion asin(Octonion u)
          Returns the principal inverse sine of this octonion o.
 Octonion asinh()
          Returns the principal inverse hyperbolic sine of this octonion o.
 Octonion asinh(Octonion u)
          Returns the principal inverse hyperbolic sine of this octonion o.
 Octonion atan()
          Returns the principal inverse tangent of this octonion o.
 Octonion atan(Octonion u)
          Returns the principal inverse tangent of this octonion o.
 Octonion atanh()
          Returns the principal inverse hyperbolic tangent of this octonion o.
 Octonion atanh(Octonion u)
          Returns the principal inverse hyperbolic tangent of this octonion o.
 Octonion ceil()
          Returns the ceiling of each of the coefficients of this octonion o.
 double coefficient(int n)
          Returns the coefficient of the nth term of this octonion o.
 Octonion conjugate()
          Returns the conjugate of this octonion o.
 Octonion cos()
          Returns the cosine of this octonion o.
 Octonion cosh()
          Returns the hyperbolic cosine of this octonion o.
 Octonion cot()
          Returns the cotangent of this octonion o.
 Octonion coth()
          Returns the hyperbolic cotangent of this octonion o.
 Octonion csc()
          Returns the cosecant of this octonion o.
 Octonion csch()
          Returns the hyperbolic cosecant of this octonion o.
 Octonion divide(Octonion p)
          Returns the quotient of this octonion o over the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.
 boolean equals(java.lang.Object p)
          Returns true if this octonion o equals the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.
 boolean equals(java.lang.Object p, double eps)
          Returns true if this octonion o equals the octonion p = b0 + ib1 + jb2 +...+ k'b7.
 Octonion exp()
          Returns Euler's number (e) raised to the power of this octonion o.
 Octonion floor()
          Returns the floor of each of the coefficients of this octonion o.
 int hashCode()
          Returns a hash code for the this octonion o based on the coefficients.
 Octonion horner(double[] v)
          Evaluate the polynomial with real coefficients, given by the array of doubles v, at this octonion o.
 Octonion imag()
          Returns the imaginary part of this octonion o.
static java.lang.String[] imaginaryUnits(java.lang.String[] units)
          Set the strings to be used for the seven imaginary units.
 boolean isImaginary()
          Returns true if the real part of this octonion o is zero and false otherwise.
 boolean isImaginary(int n)
          Returns true if the nth imaginary coefficient of this octonian o is the only non-zero coefficient and false otherwise.
 boolean isInfinite()
          Returns true if any coefficient of this octonion o is infinite and false otherwise.
 boolean isNaN()
          Returns true if any coefficient of this octonion o is not-a-number (NaN) and false otherwise.
 boolean isReal()
          Returns true if all the coefficients of the imaginary part of this octonion o are zero, otherwise false.
 boolean isZero()
          Returns true if all coefficients of this octonion o are zero, otherwise false.
 Octonion log()
          Returns the natural logarithm of this octonion o.
 Octonion log(Octonion u)
          Returns the natural logarithm of this octonion o.
 Octonion log10()
          Returns the logarithm base 10 of this octonion o.
 Octonion log10(Octonion u)
          Returns the natural logarithm of this octonion o.
 Octonion multiply(double x)
          Returns the product of this octonion o and the real number x.
 Octonion multiply(Octonion p)
          Returns the product of this octonion o and the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.
 Octonion negate()
          Returns the negative of this octonion o.
 Octonion pow(double x)
          Returns this octonion o raised to the real number x.
 Octonion pow(int n)
          Returns this octonion o raised to the integer n.
 Octonion pow(Octonion p)
          Returns this octonion o raised to the octonion p.
 Octonion project(boolean[] v)
          Project this octonion o onto the subspace defined by the boolean vector v.
 Octonion project(int n)
          Project this octonion o onto the nth term.
static Octonion random()
          A factory method for constructing an octonion with a random real and imaginary parts.
 Octonion random(boolean[] v)
          A factory method to create a random octonion defined by the boolean vector v.
static Octonion random(int n)
          A factory method for constructing an octonion with a random nth coefficient.
static Octonion randomImaginary()
          A factory method for constructing an imaginary octonion with random imaginary coefficients.
static Octonion randomReal()
          A factory method for constructing an octonion with a random real parts.
 double real()
          Returns the real part of this octonion o.
 Octonion rint()
          Returns each coefficient of the octonion o rounded to the nearest double equal to an integer.
 Octonion sec()
          Returns the secant of this octonion o.
 Octonion sech()
          Returns the hyperbolic secant of this octonion o.
 Octonion signum()
          Returns a normalized form of this octonion o when it is non-zero and o otherwise.
 Octonion sin()
          Returns the sine of this octonion o.
 Octonion sinh()
          Returns the hyperbolic sine of this octonion o.
 Octonion sqr()
          Returns the square of this octonion o.
 Octonion sqrt()
          Returns the square root of this octonion o.
 Octonion sqrt(Octonion u)
          Returns the square root of this octonion o.
 Octonion subtract(Octonion p)
          Returns the difference between this octonion o and the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.
 Octonion tan()
          Returns the tangent of this octonion o.
 Octonion tanh()
          Returns the hyperbolic tangent of this octonion o.
 double[] toArray()
          Converts this octonion o in to an array of eight doubles.
 double[] toArray(byte[] v)
          Convert this octonion o to an array of doubles.
 double[] toImagArray()
          Converts the imaginary part of this octonion o in to an array of seven doubles.
 java.lang.String toString()
          Returns a string representing this octonion o.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final Octonion ZERO
The constant 0.


ONE

public static final Octonion ONE
The constant 1.


I

public static final Octonion I
The constant i.


J

public static final Octonion J
The constant j.


K

public static final Octonion K
The constant k.


E1

public static final Octonion E1
The constant e'.


I1

public static final Octonion I1
The constant i'.


J1

public static final Octonion J1
The constant j'.


K1

public static final Octonion K1
The constant k'.


NaN

public static final Octonion NaN
The constant NaN + iNaN + jNaN + kNaN + e'NaN + i'NaN + j'NaN + k'NaN.

Constructor Detail

Octonion

public Octonion(double a0,
                double a1,
                double a2,
                double a3,
                double a4,
                double a5,
                double a6,
                double a7)

Generates the octonion a0 + ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7.

Parameters:
a0 - the real part
a1 - the coefficient of i
a2 - the coefficient of j
a3 - the coefficient of k
a4 - the coefficient of e'
a5 - the coefficient of i'
a6 - the coefficient of j'
a7 - the coefficient of k'

Octonion

public Octonion(double a0)

Generates the real octonion a0 + i0 + j0 + k0 + e'0 + i'0 + j'0 + k'0.

Parameters:
a0 - the real part

Octonion

public Octonion(double a1,
                double a2,
                double a3,
                double a4,
                double a5,
                double a6,
                double a7)

Generates the imaginary octonion 0 + ia1 + ia2 + ia3 + e'a4 + i'a5 + j'a6 + k'a7.

Parameters:
a1 - the coefficient of i
a2 - the coefficient of j
a3 - the coefficient of k
a4 - the coefficient of e'
a5 - the coefficient of i'
a6 - the coefficient of j'
a7 - the coefficient of k'

Octonion

public Octonion(double[] v)

Generates an octonion based on the entries of the array v.

An array v of length 8 defines the octonion v0 + iv1 + jv2 + kv3 + e'v4 + i'v5 + j'v6 + k'v7, and

an array v of length 7 defines the imaginary octonion 0 + iv1 + jv2 + kv3 + e'v4 + i'v5 + j'v6 + k'v7.

Parameters:
v - array of length 7 or 8

Octonion

public Octonion(double x,
                double[] v)

Generates the octonion x + iv0 + jv1 + kv2 + e'v3 + i'v4 + j'v5 + k'v6.

Parameters:
x - the real part
v - an array of doubles defining the coefficients of the imaginary part
Method Detail

random

public static final Octonion random()
A factory method for constructing an octonion with a random real and imaginary parts.

Returns:
r0 + ir1 + jr2 + kr3 + e'r4 + i'r5 + j'r6 + k'r7, where each rn is a random double.
See Also:
Math.random()

random

public static final Octonion random(int n)

A factory method for constructing an octonion with a random nth coefficient.

Returns:
r, ir, jr, kr, e'r, i'r, j'r, or k'r where r is a random double
See Also:
Math.random()

random

public final Octonion random(boolean[] v)

A factory method to create a random octonion defined by the boolean vector v.

In the result, the coefficient of the nth term is a random double if vn == true.

Parameters:
v - an array indicating a subspace
Returns:
a random octonion s
See Also:
Math.random()

randomReal

public static final Octonion randomReal()
A factory method for constructing an octonion with a random real parts.

Returns:
r where r is a random double
See Also:
Math.random()

randomImaginary

public static final Octonion randomImaginary()
A factory method for constructing an imaginary octonion with random imaginary coefficients.

Returns:
0 + ir1 + jr2 + kr3 + e'r4 + i'r5 + j'r6 + k'r7, where each rn is a random double.
See Also:
Math.random()

equals

public final boolean equals(java.lang.Object p)

Returns true if this octonion o equals the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.

The sedendions are equal if an = bn for each n.

Note: NaN == NaN returns false but 0.0 == -0.0 returns true.

Overrides:
equals in class java.lang.Object
Returns:
true if the octonions are equal.

equals

public final boolean equals(java.lang.Object p,
                            double eps)

Returns true if this octonion o equals the octonion p = b0 + ib1 + jb2 +...+ k'b7.

Two nonzero octonions o and p are equal up to ε if |o - p|/min( |o|, |p| ) < ε.

If o = 0 or p = 0 then we check that |o| < ε or |p| < ε, respectively.

Parameters:
eps - the allowable relative difference: greater than or equal to 0
Returns:
true if the octonions are approximation equal

hashCode

public final int hashCode()

Returns a hash code for the this octonion o based on the coefficients.

Overrides:
hashCode in class java.lang.Object

toString

public final java.lang.String toString()

Returns a string representing this octonion o.

If N0 = abs(a), N1 = abs(b), N2 = abs(c), and N3 = abs(d), then the return value is "[-]N0 (+|-) iN1 (+|-) jN2 (+|-) kN3".

Overrides:
toString in class java.lang.Object
Returns:
a string of the form "a + ib + jc + kd"

imaginaryUnits

public static final java.lang.String[] imaginaryUnits(java.lang.String[] units)

Set the strings to be used for the seven imaginary units.

For example, double[] {"i", "j", "k", "e(1)", "i(1)", "j(1)", "k(1)"}.

Returns:
the previously used array of imaginary units

toArray

public final double[] toArray()
Converts this octonion o in to an array of eight doubles.

Returns:
new double[] {a0, a1, a2, a3, a4, a5, a6, a7}

toArray

public final double[] toArray(byte[] v)

Convert this octonion o to an array of doubles.

The coefficient placed into the nth entry of the array is determined by vn.

Parameters:
v - an array of 0, 1, 2, 3, 4, 5, 6, or 7, indicating which coefficient is to be placed into the nth entry of the array
Returns:
an array of doubles of coefficients as specified by v

toImagArray

public final double[] toImagArray()
Converts the imaginary part of this octonion o in to an array of seven doubles.

Returns:
new double[] {a1, a2, a3, a4, a5, a6, a7}

isZero

public final boolean isZero()
Returns true if all coefficients of this octonion o are zero, otherwise false.

Returns:
true if o is zero

isReal

public final boolean isReal()
Returns true if all the coefficients of the imaginary part of this octonion o are zero, otherwise false.

Returns:
true if o is real

isImaginary

public final boolean isImaginary()
Returns true if the real part of this octonion o is zero and false otherwise.

Returns:
true if o is imaginary

isImaginary

public final boolean isImaginary(int n)
Returns true if the nth imaginary coefficient of this octonian o is the only non-zero coefficient and false otherwise.

Returns:
true if o is non-zero in only one component

isNaN

public final boolean isNaN()
Returns true if any coefficient of this octonion o is not-a-number (NaN) and false otherwise.

Returns:
true if any coefficient of o is NaN
See Also:
Double.isNaN(double)

isInfinite

public final boolean isInfinite()
Returns true if any coefficient of this octonion o is infinite and false otherwise.

Returns:
true if any coefficient of o is infinite
See Also:
Double.isInfinite(double)

abs

public final double abs()

Returns the absolute value of this octonion o.

abs(o) = |o| = sqrt(a02 + a12 + a22 + a32 + a42 + a52 + a62 + a72)

Special case:

Returns:
|o|

abs2

public final double abs2()

Returns the square of the absolute value of this octonion o.

abs2(o) = |o|2 = a02 + a12 + a22 + a32 + a42 + a52 + a62 + a72.

Special case:

Returns:
|o|2

absImag

public final double absImag()

Returns the absolute value of the imaginary part of this octonion o.

abs(imag(o)) = |imag(o)| = sqrt(a12 + a22 + a32 + a42 + a52 + a62 + a72).

Special case:

Returns:
|imag(o)|

abs2Imag

public final double abs2Imag()

Returns the square of the absolute value of the imaginary part of this octonion o.

abs2(imag(o)) = |imag(o)|2 = sqrt(a12 + a22 + a32 + a42 + a52 + a62 + a72).

Special case:

Returns:
|imag(o)|2

real

public final double real()

Returns the real part of this octonion o.

real(o) = a0.

Returns:
a0
See Also:
project(int)

imag

public final Octonion imag()

Returns the imaginary part of this octonion o.

imag(o) = ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7.

Returns:
0 + imag(o)
See Also:
project(int)

coefficient

public final double coefficient(int n)

Returns the coefficient of the nth term of this octonion o.

Parameters:
n - the number (0, 1, 2, ..., 7) of the coefficient to return
Returns:
the nth coefficient

project

public final Octonion project(int n)

Project this octonion o onto the nth term.

Parameters:
n - the number of term (0, 1, 2, ..., 15) to be projected onto
Returns:
a0, ia1, ja2, ka3, e'a4, i'a5, j'a6, or k'a7

project

public final Octonion project(boolean[] v)

Project this octonion o onto the subspace defined by the boolean vector v.

In the result, the coefficient of the nth term is set to 0.0 if vn == false.

Parameters:
v - an array indicating the terms to project onto
Returns:
a perpendicular projection of o

conjugate

public final Octonion conjugate()

Returns the conjugate of this octonion o.

conjugate(o) = a0 - ia1 - ja2 - ka3 - e'a4 - i'a5 - j'a6 - k'a7.

Returns:
a0 - ia1 - ja2 -...- k'a7

argument

public final double argument()

Returns the argument of this octonion o.

This is a value on the interval [0, &pi]. For non-zero o, if u = imag(o)/|imag(o)| then o = |o|eu argument(o).

argument(o) = atan2( |imag(o)|, a )

Returns:
atan2( |imag(o)|, a )

signum

public final Octonion signum()

Returns a normalized form of this octonion o when it is non-zero and o otherwise.

Returns:
o/|o| for nonzero o

add

public final Octonion add(Octonion p)

Returns the sum of this octonion o and the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.

o + p = (a0 + b0) + i(a1 + b1) + j(a2 + b2) + k(a3 + b3) + e'(a4 + b4) + i'(a5 + b5) + j'(a6 + b6) + k'(a7 + b7).

Returns:
o + p

add

public final Octonion add(int n,
                          double x)

Returns this octonion o with x added onto its nth term.

Parameters:
n - the number (0, 1, 2, ..., 15) of the onto which to add x
Returns:
o with x added onto the coefficient of the nth term

add

public final Octonion add(double x)

Returns the sum of this octonion o and the real number x.

o + x = (a0 + x) + ia1 + ja2 + ka3 + e'a4 + i'a5 + j'a6 + k'a7.

Returns:
o + x

subtract

public final Octonion subtract(Octonion p)

Returns the difference between this octonion o and the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.

o - p = (a0 + b0) + i(a1 - b1) + j(a2 - b2) + k(a3 - b3) + e'(a4 - b4) + i'(a5 - b5) - j'(a6 + b6) - k'(a7 + b7).

Returns:
o - p

negate

public final Octonion negate()

Returns the negative of this octonion o.

-o = -a0 - ia1 - ja2 - ka3 - e'a4 - i'a5 - j'a6 - k'a7.

Returns:
-o

multiply

public final Octonion multiply(Octonion p)

Returns the product of this octonion o and the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.

Multiplication is distributive with the following multiplication matrix for 1 and the imaginary units:

×1ijke'i'j'k'
11ijke'i'j'k'
ii-1k-ji'-e'-k'j'
jj-k-1ij'k'-e'-i'
kkj-i-1k'-j'i'-e'
e'e'-i'-j'-k'-1ijk
i'i'e'-k'j'-i-1-kj
j'j'k'e'-i'-jk-1-i
k'k'-j'i'e'-k-ji-1

In general, op ≠ po and o(pq) ≠ (op)q.

Returns:
op

multiply

public final Octonion multiply(double x)

Returns the product of this octonion o and the real number x.

ox = xa0 + ixa1 + jxa2 + kxa3 + e'xa4 + i'xa5 + j'xa6 + k'xa7.

Returns:
ox

divide

public final Octonion divide(Octonion p)

Returns the quotient of this octonion o over the octonion p = b0 + ib1 + jb2 + kb3 + e'b4 + i'b5 + j'b6 + k'b7.

o/p = oconjugate(p)/|p|2. In general, o/p ≠ (1/p)o.

Returns:
o/p

pow

public final Octonion pow(Octonion p)

Returns this octonion o raised to the octonion p.

Returns:
op

pow

public final Octonion pow(double x)

Returns this octonion o raised to the real number x.

Returns:
ox

pow

public final Octonion pow(int n)

Returns this octonion o raised to the integer n.

Returns:
on

sqr

public final Octonion sqr()

Returns the square of this octonion o.

Returns:
o2

horner

public final Octonion horner(double[] v)

Evaluate the polynomial with real coefficients, given by the array of doubles v, at this octonion o.

If n = v.length - 1 then this method evaluates v0 + v1o + ... + vnon using Horner's rule.

Returns:
v0 + v1o + ... + vnon.

sqrt

public final Octonion sqrt()

Returns the square root of this octonion o.

The branch cut is on (-∞, 0).

Returns:
sqrt(o)

sqrt

public final Octonion sqrt(Octonion u)

Returns the square root of this octonion o.

The branch cut is on (-∞, 0).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
sqrt(o)

exp

public final Octonion exp()

Returns Euler's number (e) raised to the power of this octonion o.

If o = imag(o)/|imag(o)| then eo = ea(cos|imag(o)| + u sin|imag(o)|).

Returns:
eo
See Also:
log()

log

public final Octonion log()

Returns the natural logarithm of this octonion o.

The branch cut is on (-∞, 0].

Returns:
log(o)
See Also:
exp()

log

public final Octonion log(Octonion u)

Returns the natural logarithm of this octonion o.

The branch cut is on (-∞, 0].

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
log(o)
See Also:
exp()

log10

public final Octonion log10()

Returns the logarithm base 10 of this octonion o.

The branch cut is on (-∞, 0].

Returns:
log10(o)

log10

public final Octonion log10(Octonion u)

Returns the natural logarithm of this octonion o.

The branch cut is on (-∞, 0].

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
log10(o)

sin

public final Octonion sin()

Returns the sine of this octonion o.

Returns:
sin(o)
See Also:
asin()

cos

public final Octonion cos()

Returns the cosine of this octonion o.

Returns:
cos(o)
See Also:
acos()

tan

public final Octonion tan()

Returns the tangent of this octonion o.

Returns:
tan(o)
See Also:
atan()

sec

public final Octonion sec()

Returns the secant of this octonion o.

Returns:
sec(o)
See Also:
asec()

csc

public final Octonion csc()

Returns the cosecant of this octonion o.

Returns:
csc(o)
See Also:
acsc()

cot

public final Octonion cot()

Returns the cotangent of this octonion o.

Returns:
cot(o)
See Also:
acot()

sinh

public final Octonion sinh()

Returns the hyperbolic sine of this octonion o.

Returns:
sinh(o)
See Also:
asinh()

cosh

public final Octonion cosh()

Returns the hyperbolic cosine of this octonion o.

Returns:
cosh(o)
See Also:
acosh()

tanh

public final Octonion tanh()

Returns the hyperbolic tangent of this octonion o.

Returns:
tanh(o)
See Also:
atanh()

sech

public final Octonion sech()

Returns the hyperbolic secant of this octonion o.

Returns:
sech(o)
See Also:
asech()

csch

public final Octonion csch()

Returns the hyperbolic cosecant of this octonion o.

Returns:
csch(o)
See Also:
acsch()

coth

public final Octonion coth()

Returns the hyperbolic cotangent of this octonion o.

Returns:
coth(o)
See Also:
acoth()

asin

public final Octonion asin()

Returns the principal inverse sine of this octonion o.

The branch cuts are (-∞, -1) and (1, ∞).

Returns:
asin(o)
See Also:
sin()

asin

public final Octonion asin(Octonion u)

Returns the principal inverse sine of this octonion o.

The branch cuts are (-∞, -1) and (1, ∞).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
asin(o)
See Also:
sin()

acos

public final Octonion acos()

Returns the principal inverse cosine of this octonion o.

The branch cuts are (-∞, -1) and (1, ∞).

Returns:
acos(o)
See Also:
cos()

acos

public final Octonion acos(Octonion u)

Returns the principal inverse cosine of this octonion o.

The branch cuts are (-∞, -1) and (1, ∞).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
acos(o)
See Also:
cos()

atan

public final Octonion atan()

Returns the principal inverse tangent of this octonion o.

The branch cuts are (-u∞, -u] and [u, u∞).

Returns:
atan(o)
See Also:
tan()

atan

public final Octonion atan(Octonion u)

Returns the principal inverse tangent of this octonion o.

The branch cuts are (-u∞, -u] and [u, u∞).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
atan(o)
See Also:
tan()

asec

public final Octonion asec()

Returns the principal inverse secant of this octonion o.

The branch cut is (-1, 1).

Returns:
asec(o)
See Also:
sec()

asec

public final Octonion asec(Octonion u)

Returns the principal inverse secant of this octonion o.

The branch cut is (-1, 1).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
asec(o)
See Also:
sec()

acsc

public final Octonion acsc()

Returns the principal inverse cosecant of this octonion o.

The branch cut is (-1, 1).

Returns:
acsc(o)
See Also:
csc()

acsc

public final Octonion acsc(Octonion u)

Returns the principal inverse cosecant of this octonion o.

The branch cut is (-1, 1).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
acsc(o)
See Also:
csc()

acot

public final Octonion acot()

Returns the principal inverse cotangent of this octonion o.

The branch cut is (-u, u).

Returns:
acot(o)
See Also:
cot()

acot

public final Octonion acot(Octonion u)

Returns the principal inverse cotangent of this octonion o.

The branch cut is (-u, u).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
acot(o)
See Also:
cot()

asinh

public final Octonion asinh()

Returns the principal inverse hyperbolic sine of this octonion o.

The branch cuts are (-u∞, -u) and (u, u∞).

Returns:
asinh(o)
See Also:
sinh()

asinh

public final Octonion asinh(Octonion u)

Returns the principal inverse hyperbolic sine of this octonion o.

The branch cuts are (-u∞, -u) and (u, u∞).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
asinh(o)
See Also:
sinh()

acosh

public final Octonion acosh()

Returns the principal inverse hyperbolic cosine of this octonion o.

The branch cut is (-∞, 1).

Returns:
acosh(o)
See Also:
cosh()

acosh

public final Octonion acosh(Octonion u)

Returns the principal inverse hyperbolic cosine of this octonion o.

The branch cut is (-∞, 1).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
acosh(o)
See Also:
cosh()

atanh

public final Octonion atanh()

Returns the principal inverse hyperbolic tangent of this octonion o.

The branch cuts are (-∞, -1] and [1, ∞).

Returns:
atanh(o)
See Also:
tanh()

atanh

public final Octonion atanh(Octonion u)

Returns the principal inverse hyperbolic tangent of this octonion o.

The branch cuts are (-∞, -1] and [1, ∞).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
atanh(o)
See Also:
tanh()

asech

public final Octonion asech()

Returns the principal inverse hyperbolic secant of this octonion o.

The branch cuts are (-∞, 0] and (1, ∞).

Returns:
asech(o)
See Also:
sech()

asech

public final Octonion asech(Octonion u)

Returns the principal inverse hyperbolic secant of this octonion o.

The branch cuts are (-∞, 0] and (1, ∞).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
asech(o)
See Also:
sech()

acsch

public final Octonion acsch()

Returns the principal inverse hyperbolic cosecant of this octonion o.

The branch cut is (-i, i).

Returns:
acsch(o)
See Also:
csch()

acsch

public final Octonion acsch(Octonion u)

Returns the principal inverse hyperbolic cosecant of this octonion o.

The branch cut is (-u, u).

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
acsch(o)
See Also:
csch()

acoth

public final Octonion acoth()

Returns the principal inverse hyperbolic cotangent of this octonion o.

The branch cut is [-1, 1].

Returns:
acoth(o)
See Also:
coth()

acoth

public final Octonion acoth(Octonion u)

Returns the principal inverse hyperbolic cotangent of this octonion o.

The branch cut is [-1, 1].

On the branch cuts, the imaginary part is a multiple of the imaginary octonion u.

Parameters:
u - a non-zero imaginary octonion
Returns:
acoth(o)
See Also:
coth()

ceil

public final Octonion ceil()

Returns the ceiling of each of the coefficients of this octonion o.

Returns:
ceil(a0) + i ceil(a1)+ j ceil(a2)+ k ceil(a3)+ e' ceil(a4)+ i' ceil(a5)+ j' ceil(a6)+ k' ceil(a7)
See Also:
Math.ceil(double)

floor

public final Octonion floor()

Returns the floor of each of the coefficients of this octonion o.

Returns:
floor(a0) + i floor(a1)+ j floor(a2)+ k floor(a3)+ e' floor(a4)+ i' floor(a5)+ j' floor(a6)+ k' floor(a7)
See Also:
Math.floor(double)

rint

public final Octonion rint()

Returns each coefficient of the octonion o rounded to the nearest double equal to an integer.

Returns:
rint(a0) + i rint(a1)+ j rint(a2)+ k rint(a3)+ e' rint(a4)+ i' rint(a5)+ j' rint(a6)+ k' rint(a7)
See Also:
Math.rint(double)