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 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 part
      isLipschitz -
    • 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 part
      y -
      z -
      w -
      isLipschitz -
    • HurwitzQuaternion

      public HurwitzQuaternion​(RationalQuaternion r)
      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

      public HurwitzQuaternion conjugate()
    • negate

      public HurwitzQuaternion 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

      public HurwitzQuaternion subtract​(HurwitzQuaternion b)
    • multiply

      public HurwitzQuaternion multiply​(java.math.BigInteger b)
    • multiply

      public HurwitzQuaternion multiply​(HurwitzQuaternion b)
    • square

      public HurwitzQuaternion square()
    • leftDivide

      public HurwitzQuaternion[] leftDivide​(HurwitzQuaternion b)
      "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

      public HurwitzQuaternion[] rightDivide​(HurwitzQuaternion b)
      "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

      public HurwitzQuaternion leftGcd​(HurwitzQuaternion b)
      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

      public HurwitzQuaternion rightGcd​(HurwitzQuaternion b)
      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:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toRationalQuaternion

      public RationalQuaternion toRationalQuaternion()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object