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
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:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()
static Quaternion
add
(Quaternion x, Quaternion y, int k) Return this + k * obj.addReversed
(Numeric x, int k) Calculatex+k&this
.angle()
int
Check if value is finite, infinite, or NaN.static int
compare
(Quaternion x, Quaternion y) int
Return an integer for which ofthis
orobj
is larger.cos()
static Quaternion
divide
(Quaternion x, Quaternion y) double
The value of the imaginary component, as a double.double
The value of the "j" component, as a double.double
The value of the "k" component, as a double.final double
double
The value of the real component, as a double.static boolean
equals
(Quaternion x, Quaternion y) boolean
exp()
boolean
isExact()
boolean
isZero()
static CQuaternion
static CQuaternion
jmOne()
static CQuaternion
static CQuaternion
kmOne()
log()
long
static Quaternion
make
(double re, double im, double jm, double km) static Quaternion
neg()
static Quaternion
neg
(Quaternion x) number()
static Quaternion
polar
(double r, double t, double u, double v) static Quaternion
static Quaternion
power
(Quaternion x, Quaternion y) sin()
sqrt()
tan()
static Quaternion
times
(Quaternion x, Quaternion y) toExact()
toString
(int radix) 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
-
Constructor Details
-
Quaternion
public Quaternion()
-
-
Method Details
-
number
-
isExact
public boolean isExact() -
classifyFinite
public int classifyFinite()Check if value is finite, infinite, or NaN.- Returns:
- 1 if finite; 0 if infinite; -1 if NaN.
-
toExact
-
toInexact
-
jmOne
-
jmMinusOne
-
kmOne
-
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() -
longValue
public long longValue() -
complexPart
-
vectorPart
-
unitVector
-
unitQuaternion
-
make
-
make
-
polar
-
polar
-
power
-
abs
-
angle
-
colatitude
-
longitude
-
conjugate
-
equals
-
equals
-
compare
-
compare
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). -
isZero
public boolean isZero() -
toString
-
neg
-
neg
-
add
-
add
Description copied from class:Numeric
Return this + k * obj. -
addReversed
Description copied from class:Numeric
Calculatex+k&this
.- Overrides:
addReversed
in classQuantity
-
times
-
mul
-
mulReversed
- Overrides:
mulReversed
in classQuantity
-
divide
-
div
-
divReversed
- Overrides:
divReversed
in classQuantity
-
exp
-
log
-
sqrt
-
sin
-
cos
-
tan
-