Package de.tilman_neumann.jml.quaternion
Class HurwitzQuaternion
java.lang.Object
de.tilman_neumann.jml.quaternion.HurwitzQuaternion
public class HurwitzQuaternion
extends java.lang.Object
Quaternions are an extension of complex numbers to four dimensions defined as Q(i,j,k) = {x + y*i + z*j + w*k : x,y,z,w ∈ R and i^2 = j^2 = k^2 = ijk = -1}.
The Hurwitz quaternions are quaternions with all x,y,z,w ∈ Z or all x,y,z,w ∈ Z/2. That is, either x,y,z,w are all integers, or they are all half-integers.
Unlike the general quaternions, the Hurwitz quaternions form an Euclidean ring, i.e. have an Euclidean algorithm.
Actually they have two of them because multiplication is not commutative.
-
Constructor Summary
Constructors Constructor Description HurwitzQuaternion(RationalQuaternion r)Constructor for a Hurwitz quaternion from a general quaterion with rational coefficients.HurwitzQuaternion(java.math.BigInteger x, boolean isLipschitz)Constructor for a Hurwitz quaternion with real part only, h = (x, 0, 0, 0), if isLipschitz is true, or h = (x/2, 0, 0, 0), if isLipschitz is false.HurwitzQuaternion(java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z, java.math.BigInteger w, boolean isLipschitz)Constructor for a Hurwitz quaternion h = (x, y, z, w), if isLipschitz is true, or h = (x/2, y/2, z/2, w/2), if isLipschitz is false. -
Method Summary
Modifier and Type Method Description HurwitzQuaternionadd(HurwitzQuaternion b)HurwitzQuaternionconjugate()booleanequals(java.lang.Object o)java.math.BigIntegergetW()java.math.BigIntegergetX()java.math.BigIntegergetY()java.math.BigIntegergetZ()inthashCode()booleanisUnit()The group of units in H is a nonabelian group of order 24 known as the binary tetrahedral group.booleanisZero()HurwitzQuaternion[]leftDivide(HurwitzQuaternion b)"left-divide" this by b.HurwitzQuaternionleftGcd(HurwitzQuaternion b)Computes the left Hurwitz quaternion gcd of this and b.HurwitzQuaternionmultiply(HurwitzQuaternion b)HurwitzQuaternionmultiply(java.math.BigInteger b)HurwitzQuaternionnegate()java.math.BigIntegernorm()The norm of a Hurwitz quaternion is its product with its conjugate (and in this special case the multiplication is commutative): N(x+yi+zj+wk) = (x+yi+zj+wk)*(x-yi-zj-wk) = x^2 + y^2 + z^2 + w^2, a pure integer.HurwitzQuaternion[]rightDivide(HurwitzQuaternion b)"right-divide" this by b.HurwitzQuaternionrightGcd(HurwitzQuaternion b)Computes the right Hurwitz quaternion gcd of this and b.HurwitzQuaternionsquare()HurwitzQuaternionsubtract(HurwitzQuaternion b)RationalQuaterniontoRationalQuaternion()java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
HurwitzQuaternion
public HurwitzQuaternion(java.math.BigInteger x, boolean isLipschitz)Constructor for a Hurwitz quaternion with real part only, h = (x, 0, 0, 0), if isLipschitz is true, or h = (x/2, 0, 0, 0), if isLipschitz is false.- Parameters:
x- real partisLipschitz-
-
HurwitzQuaternion
public HurwitzQuaternion(java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z, java.math.BigInteger w, boolean isLipschitz)Constructor for a Hurwitz quaternion h = (x, y, z, w), if isLipschitz is true, or h = (x/2, y/2, z/2, w/2), if isLipschitz is false.- Parameters:
x- real party-z-w-isLipschitz-
-
HurwitzQuaternion
Constructor for a Hurwitz quaternion from a general quaterion with rational coefficients.- Parameters:
r- general quaterion with rational coefficients
-
-
Method Details
-
getX
public java.math.BigInteger getX() -
getY
public java.math.BigInteger getY() -
getZ
public java.math.BigInteger getZ() -
getW
public java.math.BigInteger getW() -
conjugate
-
negate
-
norm
public java.math.BigInteger norm()The norm of a Hurwitz quaternion is its product with its conjugate (and in this special case the multiplication is commutative): N(x+yi+zj+wk) = (x+yi+zj+wk)*(x-yi-zj-wk) = x^2 + y^2 + z^2 + w^2, a pure integer.- Returns:
- the norm of this
-
isZero
public boolean isZero() -
isUnit
public boolean isUnit()The group of units in H is a nonabelian group of order 24 known as the binary tetrahedral group. The elements of this group include the 8 elements of the quaternion group Q = {±1, ±i, ±j, ±k} along with the 16 quaternions {(±1 ± i ± j ± k)/2}, where signs may be taken in any combination.- Returns:
- true if this is one of the 24 units of H.
-
add
-
subtract
-
multiply
-
multiply
-
square
-
leftDivide
"left-divide" this by b. In quaternions, there are two division algorithms, because multiplication is not commutative. The left-division variant computes a/b = conjugate(b)*a / N(b). It's resulting quotient is apt for the right term in a complementary test multiplication.- Parameters:
b-- Returns:
- [quotient, remainder] of left division
-
rightDivide
"right-divide" this by b. In quaternions, there are two division algorithms, because multiplication is not commutative. The right-division variant computes a/b = a*conjugate(b) / N(b). It's resulting quotient is apt for the left term in a complementary test multiplication.- Parameters:
b-- Returns:
- [quotient, remainder]
-
leftGcd
Computes the left Hurwitz quaternion gcd of this and b. The result is determined except for a right-sided multiplication with one of the 24 Hurwitz units.- Parameters:
b-- Returns:
- left gcd(this, b)
-
rightGcd
Computes the right Hurwitz quaternion gcd of this and b. The result is determined except for a left-sided multiplication with one of the 24 Hurwitz units.- Parameters:
b-- Returns:
- right gcd(this, b)
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toRationalQuaternion
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-