Package gnu.math
Class Quaternion
- java.lang.Object
-
- java.lang.Number
-
- gnu.math.Numeric
-
- gnu.math.Quantity
-
- gnu.math.Quaternion
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Complex
,CQuaternion
,DQuaternion
public abstract class Quaternion extends Quantity
A quaternion is a hypercomplex number of the form w + xi + yj + zk where w, x, y, and k are real, and i, j, and k are imaginary units which satisfy i^2 = j^2 = k^2 = ijk = -1.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Quaternion()
-
Method Summary
-
Methods inherited from class gnu.math.Quantity
add, compare, compareReversed, dimensions, divide, im, imValue, jm, jmValue, km, kmValue, make, make, make, re, reValue, times, unit
-
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, floatValue, geq, grt, intValue, mul_ident, power, sub, toString
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Method Detail
-
number
public Quaternion number()
-
classifyFinite
public int classifyFinite()
Check if value is finite, infinite, or NaN.- Returns:
- 1 if finite; 0 if infinite; -1 if NaN.
-
toExact
public Quaternion toExact()
-
toInexact
public Quaternion toInexact()
-
jmOne
public static CQuaternion jmOne()
-
jmMinusOne
public static CQuaternion jmMinusOne()
-
kmOne
public static CQuaternion kmOne()
-
kmMinusOne
public static CQuaternion kmMinusOne()
-
doubleValue
public double doubleValue()
Description copied from class:Quantity
The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleValue
in classQuantity
-
doubleImagValue
public double doubleImagValue()
Description copied from class:Quantity
The value of the imaginary component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleImagValue
in classQuantity
-
doubleJmagValue
public double doubleJmagValue()
Description copied from class:Quantity
The value of the "j" component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleJmagValue
in classQuantity
-
doubleKmagValue
public double doubleKmagValue()
Description copied from class:Quantity
The value of the "k" component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleKmagValue
in classQuantity
-
doubleRealValue
public final double doubleRealValue()
-
complexPart
public Complex complexPart()
-
vectorPart
public Quaternion vectorPart()
-
unitVector
public Quaternion unitVector()
-
unitQuaternion
public Quaternion unitQuaternion()
-
make
public static Quaternion make(RealNum re, RealNum im, RealNum jm, RealNum km)
-
make
public static Quaternion make(double re, double im, double jm, double km)
-
polar
public static Quaternion polar(double r, double t, double u, double v)
-
polar
public static Quaternion polar(RealNum r, RealNum t, RealNum u, RealNum v)
-
power
public static Quaternion power(Quaternion x, Quaternion y)
-
angle
public RealNum angle()
-
colatitude
public RealNum colatitude()
-
longitude
public RealNum longitude()
-
conjugate
public Quaternion conjugate()
-
equals
public static boolean equals(Quaternion x, Quaternion y)
-
compare
public static int compare(Quaternion x, Quaternion y)
-
compare
public int compare(Object obj)
Description copied from class:Numeric
Return an integer for which ofthis
orobj
is larger. Return 1 ifthis>obj
; 0 ifthis==obj
; -1 ifthis<obj
; -2 ifthis!=obj
otherwise (for example if either is NaN); -3 if not comparable (incompatible types).
-
neg
public static Quaternion neg(Quaternion x)
-
add
public static Quaternion add(Quaternion x, Quaternion y, int k)
-
add
public Numeric add(Object y, int k)
Description copied from class:Numeric
Return this + k * obj.
-
addReversed
public Numeric addReversed(Numeric x, int k)
Description copied from class:Numeric
Calculatex+k&this
.- Overrides:
addReversed
in classQuantity
-
times
public static Quaternion times(Quaternion x, Quaternion y)
-
mulReversed
public Numeric mulReversed(Numeric x)
- Overrides:
mulReversed
in classQuantity
-
divide
public static Quaternion divide(Quaternion x, Quaternion y)
-
divReversed
public Numeric divReversed(Numeric x)
- Overrides:
divReversed
in classQuantity
-
exp
public Quaternion exp()
-
log
public Quaternion log()
-
sqrt
public Quaternion sqrt()
-
sin
public Quaternion sin()
-
cos
public Quaternion cos()
-
tan
public Quaternion tan()
-
-