edu.jas.arith
Class BigOctonion

java.lang.Object
  extended by edu.jas.arith.BigOctonion
All Implemented Interfaces:
AbelianGroupElem<BigOctonion>, AbelianGroupFactory<BigOctonion>, Element<BigOctonion>, ElemFactory<BigOctonion>, GcdRingElem<BigOctonion>, MonoidElem<BigOctonion>, MonoidFactory<BigOctonion>, RingElem<BigOctonion>, RingFactory<BigOctonion>, StarRingElem<BigOctonion>, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<BigOctonion>

public final class BigOctonion
extends java.lang.Object
implements StarRingElem<BigOctonion>, GcdRingElem<BigOctonion>, RingFactory<BigOctonion>

BigOctonion class based on BigRational implementing the RingElem interface and with the familiar MAS static method names. Objects of this class are immutable.

Author:
Heinz Kredel
See Also:
Serialized Form

Field Summary
static BigOctonion I
          The constant i.
 BigQuaternion oi
          Second part of the data structure.
static BigOctonion ONE
          The constant 1.
 BigQuaternion or
          First part of the data structure.
static BigOctonion ZERO
          The constant 0.
 
Constructor Summary
BigOctonion()
          Constructor for a BigOctonion with no arguments.
BigOctonion(BigComplex r)
          Constructor for a BigOctonion from BigComplex.
BigOctonion(BigQuaternion r)
          Constructor for a BigOctonion from BigQuaternion.
BigOctonion(BigQuaternion r, BigQuaternion i)
          Constructor for a BigOctonion from Quaternions.
BigOctonion(BigRational r)
          Constructor for a BigOctonion from BigRational.
BigOctonion(long r)
          Constructor for a BigOctonion from long.
BigOctonion(java.lang.String s)
          The BigOctonion string constructor accepts the following formats: empty string, "quaternion", or "quat o quat" with no blanks around o if used as polynoial coefficient.
 
Method Summary
 BigOctonion abs()
          Octonion number absolute value.
 java.math.BigInteger characteristic()
          Characteristic of this ring.
 BigOctonion clone()
          Clone this.
 int compareTo(BigOctonion b)
          since quaternion numbers are unordered, there is no compareTo method.
 BigOctonion conjugate()
          BigOctonion conjugate.
 BigOctonion copy(BigOctonion c)
          Copy BigOctonion element c.
 BigOctonion divide(BigOctonion b)
          BigOctonion divide.
 BigOctonion divide(BigRational b)
          BigOctonion divide.
 BigOctonion[] egcd(BigOctonion S)
          BigOctonion extended greatest common divisor.
 boolean equals(java.lang.Object b)
          Comparison with any other object.
 BigOctonion fromInteger(java.math.BigInteger a)
          Get a BigOctonion element from a BigInteger.
 BigOctonion fromInteger(long a)
          Get a BigOctonion element from a long.
 BigOctonion gcd(BigOctonion S)
          Octonion number greatest common divisor.
 BigQuaternion getI()
          Get the oi part.
 BigOctonion getONE()
          Get the one element.
 BigQuaternion getR()
          Get the or part.
 BigOctonion getZERO()
          Get the zero element.
 int hashCode()
          Hash code for this BigOctonion.
 BigOctonion inverse()
          BigOctonion inverse.
 boolean isAssociative()
          Query if this ring is associative.
 boolean isCommutative()
          Query if this ring is commutative.
 boolean isField()
          Query if this ring is a field.
 boolean isIMAG()
          Is BigOctonion imaginary one.
 boolean isONE()
          Is BigOctonion number one.
static boolean isOONE(BigOctonion A)
          Is BigOctonion number one.
static boolean isOZERO(BigOctonion A)
          Is Octonion number zero.
 boolean isUnit()
          Is BigOctonion unit element.
 boolean isZERO()
          Is BigOctonion number zero.
 BigOctonion multiply(BigOctonion B)
          BigOctonion multiply.
 BigOctonion negate()
          BigOctonion number negative.
 BigOctonion norm()
          Octonion number norm.
static BigRational OABS(BigOctonion A)
          Octonion number absolute value.
static BigOctonion OCON(BigOctonion A)
          Octonion number conjugate.
static BigOctonion ODIF(BigOctonion A, BigOctonion B)
          Octonion number difference.
static BigOctonion OINV(BigOctonion A)
          Octonion number inverse.
static BigOctonion ONEG(BigOctonion A)
          Octonion number negative.
static BigOctonion OPROD(BigOctonion A, BigOctonion B)
          Octonion number product.
static BigOctonion OQ(BigOctonion A, BigOctonion B)
          Octonion number quotient.
static BigOctonion ORAND(int n)
          Octonion number, random.
static BigOctonion OSUM(BigOctonion A, BigOctonion B)
          Octonion number sum.
 BigOctonion parse(java.io.Reader r)
          Parse quaternion number from Reader.
 BigOctonion parse(java.lang.String s)
          Parse quaternion number from String.
 BigOctonion random(int n)
          BigOctonion random.
 BigOctonion random(int n, java.util.Random rnd)
          BigOctonion random.
 BigOctonion remainder(BigOctonion S)
          BigOctonion remainder.
 int signum()
          since quaternion numbers are unordered, there is no signum method.
 BigOctonion subtract(BigOctonion B)
          BigOctonion subtraction.
 BigOctonion sum(BigOctonion B)
          BigOctonion summation.
 java.lang.String toString()
          Get the string representation.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

or

public final BigQuaternion or
First part of the data structure.


oi

public final BigQuaternion oi
Second part of the data structure.


ZERO

public static final BigOctonion ZERO
The constant 0.


ONE

public static final BigOctonion ONE
The constant 1.


I

public static final BigOctonion I
The constant i.

Constructor Detail

BigOctonion

public BigOctonion(BigQuaternion r,
                   BigQuaternion i)
Constructor for a BigOctonion from Quaternions.

Parameters:
r - BigQuaternion.
i - BigQuaternion.

BigOctonion

public BigOctonion(BigQuaternion r)
Constructor for a BigOctonion from BigQuaternion.

Parameters:
r - BigQuaternion.

BigOctonion

public BigOctonion(BigComplex r)
Constructor for a BigOctonion from BigComplex.

Parameters:
r - BigComplex.

BigOctonion

public BigOctonion(BigRational r)
Constructor for a BigOctonion from BigRational.

Parameters:
r - BigRational.

BigOctonion

public BigOctonion(long r)
Constructor for a BigOctonion from long.

Parameters:
r - long.

BigOctonion

public BigOctonion()
Constructor for a BigOctonion with no arguments.


BigOctonion

public BigOctonion(java.lang.String s)
            throws java.lang.NumberFormatException
The BigOctonion string constructor accepts the following formats: empty string, "quaternion", or "quat o quat" with no blanks around o if used as polynoial coefficient.

Throws:
java.lang.NumberFormatException
Parameters:
s - String.
Method Detail

clone

public BigOctonion clone()
Clone this.

Specified by:
clone in interface Element<BigOctonion>
Overrides:
clone in class java.lang.Object
See Also:
Object.clone()
Returns:
Creates and returns a copy of this Elemnt.

copy

public BigOctonion copy(BigOctonion c)
Copy BigOctonion element c.

Specified by:
copy in interface ElemFactory<BigOctonion>
Parameters:
c - BigOctonion.
Returns:
a copy of c.

getZERO

public BigOctonion getZERO()
Get the zero element.

Specified by:
getZERO in interface AbelianGroupFactory<BigOctonion>
Returns:
0 as BigOctonion.

getONE

public BigOctonion getONE()
Get the one element.

Specified by:
getONE in interface MonoidFactory<BigOctonion>
Returns:
q as BigOctonion.

isCommutative

public boolean isCommutative()
Query if this ring is commutative.

Specified by:
isCommutative in interface MonoidFactory<BigOctonion>
Returns:
false.

isAssociative

public boolean isAssociative()
Query if this ring is associative.

Specified by:
isAssociative in interface MonoidFactory<BigOctonion>
Returns:
false.

isField

public boolean isField()
Query if this ring is a field.

Specified by:
isField in interface RingFactory<BigOctonion>
Returns:
true.

characteristic

public java.math.BigInteger characteristic()
Characteristic of this ring.

Specified by:
characteristic in interface RingFactory<BigOctonion>
Returns:
characteristic of this ring.

fromInteger

public BigOctonion fromInteger(java.math.BigInteger a)
Get a BigOctonion element from a BigInteger.

Specified by:
fromInteger in interface ElemFactory<BigOctonion>
Parameters:
a - BigInteger.
Returns:
a BigOctonion.

fromInteger

public BigOctonion fromInteger(long a)
Get a BigOctonion element from a long.

Specified by:
fromInteger in interface ElemFactory<BigOctonion>
Parameters:
a - long.
Returns:
a BigOctonion.

getR

public BigQuaternion getR()
Get the or part.

Returns:
or.

getI

public BigQuaternion getI()
Get the oi part.

Returns:
oi.

toString

public java.lang.String toString()
Get the string representation. Is compatible with the string constructor.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

isOZERO

public static boolean isOZERO(BigOctonion A)
Is Octonion number zero.

Parameters:
A - BigOctonion.
Returns:
true if A is 0, else false.

isZERO

public boolean isZERO()
Is BigOctonion number zero.

Specified by:
isZERO in interface AbelianGroupElem<BigOctonion>
See Also:
AbelianGroupElem.isZERO()
Returns:
true if this is 0, else false.

isOONE

public static boolean isOONE(BigOctonion A)
Is BigOctonion number one.

Parameters:
A - is a quaternion number.
Returns:
true if A is 1, else false.

isONE

public boolean isONE()
Is BigOctonion number one.

Specified by:
isONE in interface MonoidElem<BigOctonion>
See Also:
MonoidElem.isONE()
Returns:
true if this is 1, else false.

isIMAG

public boolean isIMAG()
Is BigOctonion imaginary one.

Returns:
true if this is i, else false.

isUnit

public boolean isUnit()
Is BigOctonion unit element.

Specified by:
isUnit in interface MonoidElem<BigOctonion>
See Also:
MonoidElem.isUnit()
Returns:
If this is a unit then true is returned, else false.

equals

public boolean equals(java.lang.Object b)
Comparison with any other object.

Specified by:
equals in interface Element<BigOctonion>
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)
Returns:
true if this is equal to b, else false.

hashCode

public int hashCode()
Hash code for this BigOctonion.

Specified by:
hashCode in interface Element<BigOctonion>
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()
Returns:
the hashCode.

compareTo

public int compareTo(BigOctonion b)
since quaternion numbers are unordered, there is no compareTo method.

Specified by:
compareTo in interface Element<BigOctonion>
Specified by:
compareTo in interface java.lang.Comparable<BigOctonion>
Parameters:
b - BigOctonion. We define the result to be
Returns:
0 if b is equal to this, 1 else.

signum

public int signum()
since quaternion numbers are unordered, there is no signum method. We define the result to be

Specified by:
signum in interface AbelianGroupElem<BigOctonion>
See Also:
AbelianGroupElem.signum()
Returns:
0 if this is equal to 0; 1 if re > 0, or re == 0 and im > 0, or ...; -1 if re < 0, or re == 0 and im < 0, or ...

sum

public BigOctonion sum(BigOctonion B)
BigOctonion summation.

Specified by:
sum in interface AbelianGroupElem<BigOctonion>
Parameters:
B - BigOctonion.
Returns:
this+B.

OSUM

public static BigOctonion OSUM(BigOctonion A,
                               BigOctonion B)
Octonion number sum.

Parameters:
A - BigOctonion.
B - BigOctonion.
Returns:
A+B.

ODIF

public static BigOctonion ODIF(BigOctonion A,
                               BigOctonion B)
Octonion number difference.

Parameters:
A - BigOctonion.
B - BigOctonion.
Returns:
A-B.

subtract

public BigOctonion subtract(BigOctonion B)
BigOctonion subtraction.

Specified by:
subtract in interface AbelianGroupElem<BigOctonion>
Parameters:
B - BigOctonion.
Returns:
this-B.

ONEG

public static BigOctonion ONEG(BigOctonion A)
Octonion number negative.

Parameters:
A - is a octonion number
Returns:
-A.

negate

public BigOctonion negate()
BigOctonion number negative.

Specified by:
negate in interface AbelianGroupElem<BigOctonion>
See Also:
AbelianGroupElem.negate()
Returns:
-this.

OCON

public static BigOctonion OCON(BigOctonion A)
Octonion number conjugate.

Parameters:
A - is a quaternion number.
Returns:
the quaternion conjugate of A.

conjugate

public BigOctonion conjugate()
BigOctonion conjugate.

Specified by:
conjugate in interface StarRingElem<BigOctonion>
Returns:
conjugate(this).

norm

public BigOctonion norm()
Octonion number norm.

Specified by:
norm in interface StarRingElem<BigOctonion>
See Also:
StarRingElem.norm()
Returns:
||this||.

abs

public BigOctonion abs()
Octonion number absolute value.

Specified by:
abs in interface AbelianGroupElem<BigOctonion>
See Also:
AbelianGroupElem.abs()
Returns:
|this|^2. Note: The square root is not jet implemented.

OABS

public static BigRational OABS(BigOctonion A)
Octonion number absolute value.

Parameters:
A - is a quaternion number.
Returns:
the absolute value of A, a rational number. Note: The square root is not jet implemented.

OPROD

public static BigOctonion OPROD(BigOctonion A,
                                BigOctonion B)
Octonion number product.

Parameters:
A - BigOctonion.
B - BigOctonion.
Returns:
A*B.

multiply

public BigOctonion multiply(BigOctonion B)
BigOctonion multiply.

Specified by:
multiply in interface MonoidElem<BigOctonion>
Parameters:
B - BigOctonion.
Returns:
this*B.

OINV

public static BigOctonion OINV(BigOctonion A)
Octonion number inverse.

Parameters:
A - is a non-zero quaternion number.
Returns:
S with S * A = 1.

inverse

public BigOctonion inverse()
BigOctonion inverse.

Specified by:
inverse in interface MonoidElem<BigOctonion>
See Also:
MonoidElem.inverse()
Returns:
S with S * this = 1.

remainder

public BigOctonion remainder(BigOctonion S)
BigOctonion remainder.

Specified by:
remainder in interface MonoidElem<BigOctonion>
Parameters:
S - BigOctonion.
Returns:
0.

OQ

public static BigOctonion OQ(BigOctonion A,
                             BigOctonion B)
Octonion number quotient.

Parameters:
A - BigOctonion.
B - BigOctonion.
Returns:
R/S.

divide

public BigOctonion divide(BigOctonion b)
BigOctonion divide.

Specified by:
divide in interface MonoidElem<BigOctonion>
Parameters:
b - BigOctonion.
Returns:
this/b.

divide

public BigOctonion divide(BigRational b)
BigOctonion divide.

Parameters:
b - BigRational.
Returns:
this/b.

random

public BigOctonion random(int n)
BigOctonion random. Random rational numbers A, B, C and D are generated using random(n). Then R is the quaternion number with real part A and imaginary parts B, C and D.

Specified by:
random in interface ElemFactory<BigOctonion>
Parameters:
n - such that 0 ≤ A, B, C, D ≤ (2n-1).
Returns:
R, a random BigOctonion.

random

public BigOctonion random(int n,
                          java.util.Random rnd)
BigOctonion random. Random rational numbers A, B, C and D are generated using RNRAND(n). Then R is the quaternion number with real part A and imaginary parts B, C and D.

Specified by:
random in interface ElemFactory<BigOctonion>
Parameters:
n - such that 0 ≤ A, B, C, D ≤ (2n-1).
rnd - is a source for random bits.
Returns:
R, a random BigOctonion.

ORAND

public static BigOctonion ORAND(int n)
Octonion number, random. Random rational numbers A, B, C and D are generated using RNRAND(n). Then R is the quaternion number with real part A and imaginary parts B, C and D.

Parameters:
n - such that 0 ≤ A, B, C, D ≤ (2n-1).
Returns:
R, a random BigOctonion.

parse

public BigOctonion parse(java.lang.String s)
Parse quaternion number from String.

Specified by:
parse in interface ElemFactory<BigOctonion>
Parameters:
s - String.
Returns:
BigOctonion from s.

parse

public BigOctonion parse(java.io.Reader r)
Parse quaternion number from Reader.

Specified by:
parse in interface ElemFactory<BigOctonion>
Parameters:
r - Reader.
Returns:
next BigOctonion from r.

gcd

public BigOctonion gcd(BigOctonion S)
Octonion number greatest common divisor.

Specified by:
gcd in interface RingElem<BigOctonion>
Parameters:
S - BigOctonion.
Returns:
gcd(this,S).

egcd

public BigOctonion[] egcd(BigOctonion S)
BigOctonion extended greatest common divisor.

Specified by:
egcd in interface RingElem<BigOctonion>
Parameters:
S - BigOctonion.
Returns:
[ gcd(this,S), a, b ] with a*this + b*S = gcd(this,S).