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>,java.io.Serializable,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
Fields Modifier and Type Field Description BigOctonionIThe constant i.BigQuaternionoiSecond part of the data structure.BigOctonionONEThe constant 1.BigQuaternionorFirst part of the data structure.BigOctonionZEROThe constant 0.
-
Constructor Summary
Constructors Constructor Description BigOctonion(BigQuaternion r)Constructor for a BigOctonion from BigQuaternion.BigOctonion(BigQuaternion r, BigQuaternion i)Constructor for a BigOctonion from Quaternions.BigOctonion(BigQuaternionRing fac)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, 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigOctonionabs()Octonion number absolute value.longbitLength()Returns the number of bits in the representation of this BigOctonion, including a sign bit.java.math.BigIntegercharacteristic()Characteristic of this ring.intcompareTo(BigOctonion b)Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.BigOctonionconjugate()BigOctonion conjugate.BigOctonioncopy()Clone this.BigOctonioncopy(BigOctonion c)Copy BigOctonion element c.BigOctoniondivide(BigOctonion b)BigOctonion divide.BigOctoniondivide(BigRational b)BigOctonion divide.BigOctonion[]egcd(BigOctonion S)BigOctonion extended greatest common divisor.booleanequals(java.lang.Object b)Comparison with any other object.BigOctonionfactory()Get the corresponding element factory.BigOctonionfromInteger(long a)Get a BigOctonion element from a long.BigOctonionfromInteger(java.math.BigInteger a)Get a BigOctonion element from a BigInteger.BigOctoniongcd(BigOctonion S)Octonion number greatest common divisor.java.util.List<BigOctonion>generators()Get a list of the generating elements.BigQuaterniongetI()Get the oi part.BigOctoniongetONE()Get the one element.BigQuaterniongetR()Get the or part.BigOctoniongetZERO()Get the zero element.inthashCode()Hash code for this BigOctonion.BigOctonioninverse()BigOctonion inverse.booleanisAssociative()Query if this ring is associative.booleanisCommutative()Query if this ring is commutative.booleanisField()Query if this ring is a field.booleanisFinite()Is this structure finite or infinite.booleanisIMAG()Is BigOctonion imaginary one.booleanisONE()Is BigOctonion number one.static booleanisOONE(BigOctonion A)Is BigOctonion number one.static booleanisOZERO(BigOctonion A)Is Octonion number zero.booleanisUnit()Is BigOctonion unit element.booleanisZERO()Is BigOctonion number zero.BigOctonionleftDivide(BigOctonion b)BigOctonion left divide.BigOctonionmultiply(BigOctonion B)BigOctonion multiply.BigOctonionnegate()BigOctonion number negative.BigOctonionnorm()Octonion number norm.static BigRationalOABS(BigOctonion A)Octonion number absolute value.static BigOctonionOCON(BigOctonion A)Octonion number conjugate.static BigOctonionODIF(BigOctonion A, BigOctonion B)Octonion number difference.static BigOctonionOINV(BigOctonion A)Octonion number inverse.static BigOctonionONEG(BigOctonion A)Octonion number negative.static BigOctonionOPROD(BigOctonion A, BigOctonion B)Octonion number product.static BigOctonionOQ(BigOctonion A, BigOctonion B)Octonion number quotient.static BigOctonionOSUM(BigOctonion A, BigOctonion B)Octonion number sum.BigOctonionparse(java.io.Reader r)Parse quaternion number from Reader.BigOctonionparse(java.lang.String s)Parse quaternion number from String.BigOctonion[]quotientRemainder(BigOctonion S)Quotient and remainder by division of this by S.BigOctonionrandom(int n)BigOctonion random.BigOctonionrandom(int n, java.util.Random rnd)BigOctonion random.BigOctonionremainder(BigOctonion S)BigOctonion remainder.BigOctonionrightDivide(BigOctonion b)BigOctonion right divide.intsignum()Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.BigOctonionsubtract(BigOctonion B)BigOctonion subtraction.BigOctonionsum(BigOctonion B)BigOctonion summation.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoScriptFactory()Get a scripting compatible string representation of the factory.java.lang.StringtoString()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 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 BigOctonion ZERO
The constant 0.
-
ONE
public BigOctonion ONE
The constant 1.
-
I
public 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(BigQuaternionRing fac, BigComplex r)
Constructor for a BigOctonion from BigComplex.- Parameters:
fac- BigQuaternionRing.r- BigComplex.
-
BigOctonion
public BigOctonion(BigQuaternionRing fac, BigRational r)
Constructor for a BigOctonion from BigRational.- Parameters:
fac- BigQuaternionRing.r- BigRational.
-
BigOctonion
public BigOctonion(BigQuaternionRing fac, long r)
Constructor for a BigOctonion from long.- Parameters:
fac- BigQuaternionRing.r- long.
-
BigOctonion
public BigOctonion(BigQuaternionRing fac)
Constructor for a BigOctonion with no arguments.- Parameters:
fac- BigQuaternionRing.
-
BigOctonion
public BigOctonion(BigQuaternionRing fac, 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.- Parameters:
fac- BigQuaternionRing.s- String.- Throws:
java.lang.NumberFormatException
-
-
Method Detail
-
factory
public BigOctonion factory()
Get the corresponding element factory.- Specified by:
factoryin interfaceElement<BigOctonion>- Returns:
- factory for this Element.
- See Also:
Element.factory()
-
generators
public java.util.List<BigOctonion> generators()
Get a list of the generating elements.- Specified by:
generatorsin interfaceElemFactory<BigOctonion>- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
isFinite
public boolean isFinite()
Is this structure finite or infinite.- Specified by:
isFinitein interfaceElemFactory<BigOctonion>- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
copy
public BigOctonion copy()
Clone this.- Specified by:
copyin interfaceElement<BigOctonion>- Returns:
- Creates and returns a copy of this Element.
- See Also:
Object.clone()
-
copy
public BigOctonion copy(BigOctonion c)
Copy BigOctonion element c.- Specified by:
copyin interfaceElemFactory<BigOctonion>- Parameters:
c- BigOctonion.- Returns:
- a copy of c.
-
getZERO
public BigOctonion getZERO()
Get the zero element.- Specified by:
getZEROin interfaceAbelianGroupFactory<BigOctonion>- Returns:
- 0 as BigOctonion.
-
getONE
public BigOctonion getONE()
Get the one element.- Specified by:
getONEin interfaceMonoidFactory<BigOctonion>- Returns:
- q as BigOctonion.
-
isCommutative
public boolean isCommutative()
Query if this ring is commutative.- Specified by:
isCommutativein interfaceMonoidFactory<BigOctonion>- Returns:
- false.
-
isAssociative
public boolean isAssociative()
Query if this ring is associative.- Specified by:
isAssociativein interfaceMonoidFactory<BigOctonion>- Returns:
- false.
-
isField
public boolean isField()
Query if this ring is a field.- Specified by:
isFieldin interfaceRingFactory<BigOctonion>- Returns:
- true.
-
characteristic
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristicin interfaceRingFactory<BigOctonion>- Returns:
- characteristic of this ring.
-
fromInteger
public BigOctonion fromInteger(java.math.BigInteger a)
Get a BigOctonion element from a BigInteger.- Specified by:
fromIntegerin interfaceElemFactory<BigOctonion>- Parameters:
a- BigInteger.- Returns:
- a BigOctonion.
-
fromInteger
public BigOctonion fromInteger(long a)
Get a BigOctonion element from a long.- Specified by:
fromIntegerin interfaceElemFactory<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:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElement<BigOctonion>- Specified by:
toScriptin interfaceElemFactory<BigOctonion>- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<BigOctonion>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
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:
isZEROin interfaceAbelianGroupElem<BigOctonion>- Returns:
- true if this is 0, else false.
- See Also:
AbelianGroupElem.isZERO()
-
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:
isONEin interfaceMonoidElem<BigOctonion>- Returns:
- true if this is 1, else false.
- See Also:
MonoidElem.isONE()
-
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:
isUnitin interfaceMonoidElem<BigOctonion>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
MonoidElem.isUnit()
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.- Specified by:
equalsin interfaceElement<BigOctonion>- Overrides:
equalsin classjava.lang.Object- Returns:
- true if this is equal to b, else false.
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this BigOctonion.- Specified by:
hashCodein interfaceElement<BigOctonion>- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashCode.
- See Also:
Object.hashCode()
-
compareTo
public int compareTo(BigOctonion b)
Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.- Specified by:
compareToin interfacejava.lang.Comparable<BigOctonion>- Specified by:
compareToin 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:
signumin 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:
AbelianGroupElem.signum()
-
sum
public BigOctonion sum(BigOctonion B)
BigOctonion summation.- Specified by:
sumin interfaceAbelianGroupElem<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:
subtractin interfaceAbelianGroupElem<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:
negatein interfaceAbelianGroupElem<BigOctonion>- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
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:
conjugatein interfaceStarRingElem<BigOctonion>- Returns:
- conjugate(this).
-
norm
public BigOctonion norm()
Octonion number norm.- Specified by:
normin interfaceStarRingElem<BigOctonion>- Returns:
- ||this||.
- See Also:
StarRingElem.norm()
-
abs
public BigOctonion abs()
Octonion number absolute value.- Specified by:
absin interfaceAbelianGroupElem<BigOctonion>- Returns:
- |this|.
- See Also:
AbelianGroupElem.abs()
-
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:
multiplyin interfaceMonoidElem<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:
inversein interfaceMonoidElem<BigOctonion>- Returns:
- S with S * this = 1.
- See Also:
MonoidElem.inverse()
-
remainder
public BigOctonion remainder(BigOctonion S)
BigOctonion remainder.- Specified by:
remainderin interfaceMonoidElem<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:
dividein interfaceMonoidElem<BigOctonion>- Parameters:
b- BigOctonion.- Returns:
- this * b**(-1).
-
rightDivide
public BigOctonion rightDivide(BigOctonion b)
BigOctonion right divide.- Specified by:
rightDividein interfaceMonoidElem<BigOctonion>- Parameters:
b- BigOctonion.- Returns:
- this * b**(-1).
-
leftDivide
public BigOctonion leftDivide(BigOctonion b)
BigOctonion left divide.- Specified by:
leftDividein interfaceMonoidElem<BigOctonion>- Parameters:
b- BigOctonion.- Returns:
- b**(-1) * this.
-
divide
public BigOctonion divide(BigRational b)
BigOctonion divide.- Parameters:
b- BigRational.- Returns:
- this/b.
-
quotientRemainder
public BigOctonion[] quotientRemainder(BigOctonion S)
Quotient and remainder by division of this by S.- Specified by:
quotientRemainderin interfaceMonoidElem<BigOctonion>- Parameters:
S- a octonion number- Returns:
- [this/S, this - (this/S)*S].
-
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:
randomin interfaceElemFactory<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:
randomin 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
public BigOctonion parse(java.lang.String s)
Parse quaternion number from String.- Specified by:
parsein interfaceElemFactory<BigOctonion>- Parameters:
s- String.- Returns:
- BigOctonion from s.
-
parse
public BigOctonion parse(java.io.Reader r)
Parse quaternion number from Reader.- Specified by:
parsein interfaceElemFactory<BigOctonion>- Parameters:
r- Reader.- Returns:
- next BigOctonion from r.
-
gcd
public BigOctonion gcd(BigOctonion S)
Octonion number greatest common divisor.- Specified by:
gcdin interfaceRingElem<BigOctonion>- Parameters:
S- BigOctonion.- Returns:
- gcd(this,S).
-
egcd
public BigOctonion[] egcd(BigOctonion S)
BigOctonion extended greatest common divisor.- Specified by:
egcdin 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.
-
-