Package edu.jas.arith
Class BigOctonion
java.lang.Object
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>
,Serializable
,Comparable<BigOctonion>
public final class BigOctonion
extends 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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final boolean
The constant i.private static final org.apache.logging.log4j.Logger
final BigQuaternion
Second part of the data structure.The constant 1.final BigQuaternion
First part of the data structure.private static final Random
The constant 0. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a BigOctonion from BigQuaternion.Constructor for a BigOctonion from Quaternions.Constructor for a BigOctonion with no arguments.BigOctonion
(BigQuaternionRing fac, long r) Constructor for a BigOctonion from long.BigOctonion
(BigQuaternionRing fac, BigComplex r) Constructor for a BigOctonion from BigComplex.BigOctonion
(BigQuaternionRing fac, BigRational r) Constructor for a BigOctonion from BigRational.BigOctonion
(BigQuaternionRing fac, 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
Modifier and TypeMethodDescriptionabs()
Octonion number absolute value.long
Returns the number of bits in the representation of this BigOctonion, including a sign bit.Characteristic of this ring.int
Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.BigOctonion conjugate.copy()
Clone this.copy
(BigOctonion c) Copy BigOctonion element c.BigOctonion divide.BigOctonion divide.egcd
(BigOctonion S) BigOctonion extended greatest common divisor.boolean
Comparison with any other object.factory()
Get the corresponding element factory.fromInteger
(long a) Get a BigOctonion element from a long.Get a BigOctonion element from a BigInteger.gcd
(BigOctonion S) Octonion number greatest common divisor.Get a list of the generating elements.getI()
Get the oi part.getONE()
Get the one element.getR()
Get the or part.getZERO()
Get the zero element.int
hashCode()
Hash code for this BigOctonion.inverse()
BigOctonion inverse.boolean
Query if this ring is associative.boolean
Query if this ring is commutative.boolean
isField()
Query if this ring is a field.boolean
isFinite()
Is this structure finite or infinite.boolean
isIMAG()
Is BigOctonion imaginary one.boolean
isONE()
Is BigOctonion number one.static boolean
Is BigOctonion number one.static boolean
Is Octonion number zero.boolean
isUnit()
Is BigOctonion unit element.boolean
isZERO()
Is BigOctonion number zero.BigOctonion left divide.BigOctonion multiply.negate()
BigOctonion number negative.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
OSUM
(BigOctonion A, BigOctonion B) Octonion number sum.Parse quaternion number from Reader.Parse quaternion number from String.Quotient and remainder by division of this by S.random
(int n) BigOctonion random.BigOctonion random.BigOctonion remainder.BigOctonion right divide.int
signum()
Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.BigOctonion subtraction.sum
(BigOctonion B) BigOctonion summation.toScript()
Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()
Get the string representation.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.jas.structure.ElemFactory
valueOf
Methods inherited from interface edu.jas.structure.MonoidElem
leftRemainder, power, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
or
First part of the data structure. -
oi
Second part of the data structure. -
random
-
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug -
ZERO
The constant 0. -
ONE
The constant 1. -
I
The constant i.
-
-
Constructor Details
-
BigOctonion
Constructor for a BigOctonion from Quaternions.- Parameters:
r
- BigQuaternion.i
- BigQuaternion.
-
BigOctonion
Constructor for a BigOctonion from BigQuaternion.- Parameters:
r
- BigQuaternion.
-
BigOctonion
Constructor for a BigOctonion from BigComplex.- Parameters:
fac
- BigQuaternionRing.r
- BigComplex.
-
BigOctonion
Constructor for a BigOctonion from BigRational.- Parameters:
fac
- BigQuaternionRing.r
- BigRational.
-
BigOctonion
Constructor for a BigOctonion from long.- Parameters:
fac
- BigQuaternionRing.r
- long.
-
BigOctonion
Constructor for a BigOctonion with no arguments.- Parameters:
fac
- BigQuaternionRing.
-
BigOctonion
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.- Parameters:
fac
- BigQuaternionRing.s
- String.- Throws:
NumberFormatException
-
-
Method Details
-
factory
Get the corresponding element factory.- Specified by:
factory
in interfaceElement<BigOctonion>
- Returns:
- factory for this Element.
- See Also:
-
generators
Get a list of the generating elements.- Specified by:
generators
in interfaceElemFactory<BigOctonion>
- Returns:
- list of generators for the algebraic structure.
- See Also:
-
isFinite
public boolean isFinite()Is this structure finite or infinite.- Specified by:
isFinite
in interfaceElemFactory<BigOctonion>
- Returns:
- true if this structure is finite, else false.
- See Also:
-
copy
Clone this.- Specified by:
copy
in interfaceElement<BigOctonion>
- Returns:
- Creates and returns a copy of this Element.
- See Also:
-
copy
Copy BigOctonion element c.- Specified by:
copy
in interfaceElemFactory<BigOctonion>
- Parameters:
c
- BigOctonion.- Returns:
- a copy of c.
-
getZERO
Get the zero element.- Specified by:
getZERO
in interfaceAbelianGroupFactory<BigOctonion>
- Returns:
- 0 as BigOctonion.
-
getONE
Get the one element.- Specified by:
getONE
in interfaceMonoidFactory<BigOctonion>
- Returns:
- q as BigOctonion.
-
isCommutative
public boolean isCommutative()Query if this ring is commutative.- Specified by:
isCommutative
in interfaceMonoidFactory<BigOctonion>
- Returns:
- false.
-
isAssociative
public boolean isAssociative()Query if this ring is associative.- Specified by:
isAssociative
in interfaceMonoidFactory<BigOctonion>
- Returns:
- false.
-
isField
public boolean isField()Query if this ring is a field.- Specified by:
isField
in interfaceRingFactory<BigOctonion>
- Returns:
- true.
-
characteristic
Characteristic of this ring.- Specified by:
characteristic
in interfaceRingFactory<BigOctonion>
- Returns:
- characteristic of this ring.
-
fromInteger
Get a BigOctonion element from a BigInteger.- Specified by:
fromInteger
in interfaceElemFactory<BigOctonion>
- Parameters:
a
- BigInteger.- Returns:
- a BigOctonion.
-
fromInteger
Get a BigOctonion element from a long.- Specified by:
fromInteger
in interfaceElemFactory<BigOctonion>
- Parameters:
a
- long.- Returns:
- a BigOctonion.
-
getR
Get the or part.- Returns:
- or.
-
getI
Get the oi part.- Returns:
- oi.
-
toString
Get the string representation. Is compatible with the string constructor. -
toScript
Get a scripting compatible string representation.- Specified by:
toScript
in interfaceElement<BigOctonion>
- Specified by:
toScript
in interfaceElemFactory<BigOctonion>
- Returns:
- script compatible representation for this Element.
- See Also:
-
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<BigOctonion>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
isOZERO
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 interfaceAbelianGroupElem<BigOctonion>
- Returns:
- true if this is 0, else false.
- See Also:
-
isOONE
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 interfaceMonoidElem<BigOctonion>
- Returns:
- true if this is 1, else false.
- See Also:
-
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 interfaceMonoidElem<BigOctonion>
- Returns:
- If this is a unit then true is returned, else false.
- See Also:
-
equals
Comparison with any other object.- Specified by:
equals
in interfaceElement<BigOctonion>
- Overrides:
equals
in classObject
- Parameters:
b
-- Returns:
- true if this is equal to b, else false.
- See Also:
-
hashCode
public int hashCode()Hash code for this BigOctonion.- Specified by:
hashCode
in interfaceElement<BigOctonion>
- Overrides:
hashCode
in classObject
- Returns:
- the hashCode.
- See Also:
-
compareTo
Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.- Specified by:
compareTo
in interfaceComparable<BigOctonion>
- Specified by:
compareTo
in interfaceElement<BigOctonion>
- Parameters:
b
- BigOctonion.- Returns:
- 0 if b is equal to this, 1 if this is greater b and -1 else.
-
signum
public int signum()Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.- Specified by:
signum
in interfaceAbelianGroupElem<BigOctonion>
- Returns:
- 0 if this is equal to 0; 1 if or > 0, or or == 0 and oi > 0; -1 if or < 0, or or == 0 and oi < 0.
- See Also:
-
sum
BigOctonion summation.- Specified by:
sum
in interfaceAbelianGroupElem<BigOctonion>
- Parameters:
B
- BigOctonion.- Returns:
- this+B.
-
OSUM
Octonion number sum.- Parameters:
A
- BigOctonion.B
- BigOctonion.- Returns:
- A+B.
-
ODIF
Octonion number difference.- Parameters:
A
- BigOctonion.B
- BigOctonion.- Returns:
- A-B.
-
subtract
BigOctonion subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<BigOctonion>
- Parameters:
B
- BigOctonion.- Returns:
- this-B.
-
ONEG
Octonion number negative.- Parameters:
A
- is a octonion number- Returns:
- -A.
-
negate
BigOctonion number negative.- Specified by:
negate
in interfaceAbelianGroupElem<BigOctonion>
- Returns:
- -this.
- See Also:
-
OCON
Octonion number conjugate.- Parameters:
A
- is a quaternion number.- Returns:
- the quaternion conjugate of A.
-
conjugate
BigOctonion conjugate.- Specified by:
conjugate
in interfaceStarRingElem<BigOctonion>
- Returns:
- conjugate(this).
-
norm
Octonion number norm.- Specified by:
norm
in interfaceStarRingElem<BigOctonion>
- Returns:
- ||this||.
- See Also:
-
abs
Octonion number absolute value.- Specified by:
abs
in interfaceAbelianGroupElem<BigOctonion>
- Returns:
- |this|.
- See Also:
-
OABS
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
Octonion number product.- Parameters:
A
- BigOctonion.B
- BigOctonion.- Returns:
- A*B.
-
multiply
BigOctonion multiply.- Specified by:
multiply
in interfaceMonoidElem<BigOctonion>
- Parameters:
B
- BigOctonion.- Returns:
- this*B.
-
OINV
Octonion number inverse.- Parameters:
A
- is a non-zero quaternion number.- Returns:
- S with S * A = 1.
-
inverse
BigOctonion inverse.- Specified by:
inverse
in interfaceMonoidElem<BigOctonion>
- Returns:
- S with S * this = 1.
- See Also:
-
remainder
BigOctonion remainder.- Specified by:
remainder
in interfaceMonoidElem<BigOctonion>
- Parameters:
S
- BigOctonion.- Returns:
- 0.
-
OQ
Octonion number quotient.- Parameters:
A
- BigOctonion.B
- BigOctonion.- Returns:
- R/S.
-
divide
BigOctonion divide.- Specified by:
divide
in interfaceMonoidElem<BigOctonion>
- Parameters:
b
- BigOctonion.- Returns:
- this * b**(-1).
-
rightDivide
BigOctonion right divide.- Specified by:
rightDivide
in interfaceMonoidElem<BigOctonion>
- Parameters:
b
- BigOctonion.- Returns:
- this * b**(-1).
-
leftDivide
BigOctonion left divide.- Specified by:
leftDivide
in interfaceMonoidElem<BigOctonion>
- Parameters:
b
- BigOctonion.- Returns:
- b**(-1) * this.
-
divide
BigOctonion divide.- Parameters:
b
- BigRational.- Returns:
- this/b.
-
quotientRemainder
Quotient and remainder by division of this by S.- Specified by:
quotientRemainder
in interfaceMonoidElem<BigOctonion>
- Parameters:
S
- a octonion number- Returns:
- [this/S, this - (this/S)*S].
-
random
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 interfaceElemFactory<BigOctonion>
- Parameters:
n
- such that 0 ≤ A, B, C, D ≤ (2n-1).- Returns:
- R, a random BigOctonion.
-
random
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 interfaceElemFactory<BigOctonion>
- Parameters:
n
- such that 0 ≤ A, B, C, D ≤ (2n-1).rnd
- is a source for random bits.- Returns:
- R, a random BigOctonion.
-
parse
Parse quaternion number from String.- Specified by:
parse
in interfaceElemFactory<BigOctonion>
- Parameters:
s
- String.- Returns:
- BigOctonion from s.
-
parse
Parse quaternion number from Reader.- Specified by:
parse
in interfaceElemFactory<BigOctonion>
- Parameters:
r
- Reader.- Returns:
- next BigOctonion from r.
-
gcd
Octonion number greatest common divisor.- Specified by:
gcd
in interfaceRingElem<BigOctonion>
- Parameters:
S
- BigOctonion.- Returns:
- gcd(this,S).
-
egcd
BigOctonion extended greatest common divisor.- Specified by:
egcd
in interfaceRingElem<BigOctonion>
- Parameters:
S
- BigOctonion.- Returns:
- [ gcd(this,S), a, b ] with a*this + b*S = gcd(this,S).
-
bitLength
public long bitLength()Returns the number of bits in the representation of this BigOctonion, including a sign bit. It is equivalent toor.bitLength() + oi.bitLength()
.)- Returns:
- number of bits in the representation of this BigOctonion, including a sign bit.
-