org.jscience.mathematics.algebraic.numbers
Class ExactQuaternion

java.lang.Object
  extended by java.lang.Number
      extended by org.jscience.mathematics.algebraic.numbers.ExactQuaternion
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Algebra.Member, BanachSpace.Member, CStarAlgebra.Member, Field.Member, Ring.Member, AbelianGroup.Member, Module.Member, VectorSpace.Member, Member

public final class ExactQuaternion
extends java.lang.Number
implements java.lang.Cloneable, java.io.Serializable, Field.Member, CStarAlgebra.Member

The ExactQuaternion class encapsulates quaternions.

See Also:
Serialized Form

Field Summary
static ExactQuaternion I
           
static ExactQuaternion J
           
static ExactQuaternion K
           
static ExactQuaternion ONE
           
static java.lang.Class TYPE
           
static ExactQuaternion ZERO
           
 
Constructor Summary
ExactQuaternion(double real, Double3Vector imag)
          Constructs a quaternion.
ExactQuaternion(double q0, double q1, double q2, double q3)
          Constructs the quaternion q0+iq1+jq2+kq3.
ExactQuaternion(ExactQuaternion quaternion)
          Constructs the quaternion q0+iq1+jq2+kq3.
ExactQuaternion(ExactReal q0, ExactReal q1, ExactReal q2, ExactReal q3)
          Constructs the quaternion q0+iq1+jq2+kq3.
ExactQuaternion(Quaternion quaternion)
          Constructs the quaternion q0+iq1+jq2+kq3.
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member x)
          Returns the addition of this number and another.
 ExactQuaternion add(ExactQuaternion q)
          Returns the addition of this quaternion and another.
 ExactQuaternion add(Quaternion q)
          Returns the addition of this quaternion and another.
 ExactQuaternion addImag(RingVector imag)
          Returns the addition of this quaternion with an imaginary part.
 ExactQuaternion addReal(double real)
          Returns the addition of this quaternion with a real part.
 ExactQuaternion addReal(ExactReal real)
          Returns the addition of this quaternion with a real part.
 java.lang.Object clone()
           
 ExactQuaternion conjugate()
          Returns the conjugate of this quaternion.
 ExactQuaternion divide(double x)
          Returns the division of this quaternion by a scalar.
 ExactQuaternion divide(ExactQuaternion q)
          Returns the division of this quaternion by another.
 ExactQuaternion divide(ExactReal x)
          Returns the division of this quaternion by a scalar.
 Field.Member divide(Field.Member x)
          Returns the division of this number and another.
 double doubleValue()
           
 boolean equals(java.lang.Object obj)
          Compares two quaternions for equality.
 float floatValue()
           
 int hashCode()
          Returns a hashcode for this quaternion.
 RingVector imag()
          Returns the imaginary part of this quaternion as a Vector of length 3.
 int intValue()
           
 Field.Member inverse()
          Returns the inverse of this quaternion.
 CStarAlgebra.Member involution()
          Returns the involution of this quaternion.
 boolean isInfinite()
          Returns true if either the real or imaginary part is infinite.
 boolean isNaN()
          Returns true if either the real or imaginary part is NaN.
 long longValue()
           
 ExactQuaternion multiply(double x)
          Returns the multiplication of this quaternion by a scalar.
 ExactQuaternion multiply(ExactQuaternion q)
          Returns the multiplication of this quaternion and another.
 ExactQuaternion multiply(ExactReal x)
          Returns the multiplication of this quaternion by a scalar.
 ExactQuaternion multiply(Quaternion q)
          Returns the multiplication of this quaternion and another.
 Ring.Member multiply(Ring.Member x)
          Returns the multiplication of this number and another.
 AbelianGroup.Member negate()
          Returns the negative of this quaternion.
 double norm()
          Returns the l2-norm (magnitude), which is also the C* norm.
 ExactReal real()
          Returns the real part of this quaternion.
 VectorSpace.Member scalarDivide(Field.Member x)
          Returns the division of this number by a real scalar.
 Module.Member scalarMultiply(Ring.Member x)
          Returns the multiplication of this number by a real scalar.
 AbelianGroup.Member subtract(AbelianGroup.Member x)
          Returns the subtraction of this number and another.
 ExactQuaternion subtract(ExactQuaternion q)
          Returns the subtraction of this quaternion and another.
 ExactQuaternion subtract(Quaternion q)
          Returns the subtraction of this quaternion and another.
 ExactQuaternion subtractImag(RingVector imag)
          Returns the subtraction of this quaternion with an imaginary part.
 ExactQuaternion subtractReal(double real)
          Returns the subtraction of this quaternion with a real part.
 ExactQuaternion subtractReal(ExactReal real)
          Returns the subtraction of this quaternion with a real part.
 ExactReal sumSquares()
          Returns the sum of the squares of the components.
 java.lang.String toString()
          Returns a string representing the value of this quaternion.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final ExactQuaternion ZERO

ONE

public static final ExactQuaternion ONE

I

public static final ExactQuaternion I

J

public static final ExactQuaternion J

K

public static final ExactQuaternion K

TYPE

public static final java.lang.Class TYPE
Constructor Detail

ExactQuaternion

public ExactQuaternion(double real,
                       Double3Vector imag)
Constructs a quaternion.


ExactQuaternion

public ExactQuaternion(double q0,
                       double q1,
                       double q2,
                       double q3)
Constructs the quaternion q0+iq1+jq2+kq3.


ExactQuaternion

public ExactQuaternion(ExactReal q0,
                       ExactReal q1,
                       ExactReal q2,
                       ExactReal q3)
Constructs the quaternion q0+iq1+jq2+kq3.


ExactQuaternion

public ExactQuaternion(Quaternion quaternion)
Constructs the quaternion q0+iq1+jq2+kq3.


ExactQuaternion

public ExactQuaternion(ExactQuaternion quaternion)
Constructs the quaternion q0+iq1+jq2+kq3.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two quaternions for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a quaternion

toString

public java.lang.String toString()
Returns a string representing the value of this quaternion.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Returns a hashcode for this quaternion.

Overrides:
hashCode in class java.lang.Object

isNaN

public boolean isNaN()
Returns true if either the real or imaginary part is NaN.


isInfinite

public boolean isInfinite()
Returns true if either the real or imaginary part is infinite.


real

public ExactReal real()
Returns the real part of this quaternion.


imag

public RingVector imag()
Returns the imaginary part of this quaternion as a Vector of length 3.


norm

public double norm()
Returns the l2-norm (magnitude), which is also the C* norm.

Specified by:
norm in interface BanachSpace.Member
Returns:
DOCUMENT ME!

sumSquares

public ExactReal sumSquares()
Returns the sum of the squares of the components.


intValue

public int intValue()
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Specified by:
longValue in class java.lang.Number

floatValue

public float floatValue()
Specified by:
floatValue in class java.lang.Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class java.lang.Number

negate

public AbelianGroup.Member negate()
Returns the negative of this quaternion.

Specified by:
negate in interface AbelianGroup.Member
Returns:
DOCUMENT ME!

inverse

public Field.Member inverse()
Returns the inverse of this quaternion.

Specified by:
inverse in interface Field.Member
Returns:
DOCUMENT ME!

involution

public CStarAlgebra.Member involution()
Returns the involution of this quaternion.

Specified by:
involution in interface CStarAlgebra.Member
Returns:
DOCUMENT ME!

conjugate

public ExactQuaternion conjugate()
Returns the conjugate of this quaternion.


add

public AbelianGroup.Member add(AbelianGroup.Member x)
Returns the addition of this number and another.

Specified by:
add in interface AbelianGroup.Member
Parameters:
x - a group member
Returns:
DOCUMENT ME!

add

public ExactQuaternion add(ExactQuaternion q)
Returns the addition of this quaternion and another.

Parameters:
q - a quaternion

add

public ExactQuaternion add(Quaternion q)
Returns the addition of this quaternion and another.

Parameters:
q - a quaternion

addReal

public ExactQuaternion addReal(double real)
Returns the addition of this quaternion with a real part.

Parameters:
real - a real part

addReal

public ExactQuaternion addReal(ExactReal real)
Returns the addition of this quaternion with a real part.

Parameters:
real - a real part

addImag

public ExactQuaternion addImag(RingVector imag)
Returns the addition of this quaternion with an imaginary part.

Parameters:
imag - an imaginary part

subtract

public AbelianGroup.Member subtract(AbelianGroup.Member x)
Returns the subtraction of this number and another.

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
x - a group member
Returns:
DOCUMENT ME!

subtract

public ExactQuaternion subtract(ExactQuaternion q)
Returns the subtraction of this quaternion and another.

Parameters:
q - a quaternion

subtract

public ExactQuaternion subtract(Quaternion q)
Returns the subtraction of this quaternion and another.

Parameters:
q - a quaternion

subtractReal

public ExactQuaternion subtractReal(double real)
Returns the subtraction of this quaternion with a real part.

Parameters:
real - a real part

subtractReal

public ExactQuaternion subtractReal(ExactReal real)
Returns the subtraction of this quaternion with a real part.

Parameters:
real - a real part

subtractImag

public ExactQuaternion subtractImag(RingVector imag)
Returns the subtraction of this quaternion with an imaginary part.

Parameters:
imag - an imaginary part

scalarMultiply

public Module.Member scalarMultiply(Ring.Member x)
Returns the multiplication of this number by a real scalar.

Specified by:
scalarMultiply in interface Module.Member
Parameters:
x - a ring member
Returns:
DOCUMENT ME!

multiply

public Ring.Member multiply(Ring.Member x)
Returns the multiplication of this number and another.

Specified by:
multiply in interface Ring.Member
Parameters:
x - a ring member
Returns:
DOCUMENT ME!

multiply

public ExactQuaternion multiply(ExactQuaternion q)
Returns the multiplication of this quaternion and another.

Parameters:
q - a quaternion

multiply

public ExactQuaternion multiply(Quaternion q)
Returns the multiplication of this quaternion and another.

Parameters:
q - a real number

multiply

public ExactQuaternion multiply(double x)
Returns the multiplication of this quaternion by a scalar.

Parameters:
x - a real number

multiply

public ExactQuaternion multiply(ExactReal x)
Returns the multiplication of this quaternion by a scalar.

Parameters:
x - a real number

scalarDivide

public VectorSpace.Member scalarDivide(Field.Member x)
Returns the division of this number by a real scalar.

Specified by:
scalarDivide in interface VectorSpace.Member
Parameters:
x - a field member
Returns:
DOCUMENT ME!

divide

public Field.Member divide(Field.Member x)
Returns the division of this number and another.

Specified by:
divide in interface Field.Member
Parameters:
x - a field member
Returns:
DOCUMENT ME!

divide

public ExactQuaternion divide(ExactQuaternion q)
Returns the division of this quaternion by another.

Parameters:
q - a quaternion
Throws:
java.lang.ArithmeticException - If divide by zero.

divide

public ExactQuaternion divide(double x)
Returns the division of this quaternion by a scalar.

Parameters:
x - a real number
Throws:
java.lang.ArithmeticException - If divide by zero.

divide

public ExactQuaternion divide(ExactReal x)
Returns the division of this quaternion by a scalar.

Parameters:
x - a real number
Throws:
java.lang.ArithmeticException - If divide by zero.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object