Absolute value, or modulus
(Quaternion and octonion overloadings of standard MATLAB® function)
Y = abs(X)
abs(X) returns an array Y such that each element of Y is the absolute value, or modulus, of the corresponding element of X.
If X is a complex quaternion, abs(X) returns the complex modulus, the square root of the complex semi-norm, computed in the same way (the square root of the sum of the squares of the components of the quaternion). The semi-norm of a complex quaternion can vanish (see references), and therefore so can the modulus.
abs(quaternion(1,1,1,1)) ans = 2abs is vectorized, and hence can operate on arrays:
abs([qi, qj, qk, qi + qj]) ans = 1.0000 1.0000 1.0000 1.4142It can also operate on complex quaternions, with complex modulus, in general:
abs(1 + i + qi + qj + qk) ans = 1.8174 + 0.5503iThe following shows that a complex quaternion can have a vanishing modulus (and semi-norm):
abs(i + qi) ans = 0