is_real#
- Quaternion.is_real() bool #
Returns a bool value, where
True
if quaternion is real.A real quaternion has all elements of its vector part equal to zero: \(\mathbf{q} = w + 0i + 0j + 0k = \begin{pmatrix} q_w & \mathbf{0}\end{pmatrix}\)
\[\begin{split}\left\{ \begin{array}{ll} \mathrm{True} & \: \mathbf{q}_v = \begin{bmatrix} 0 & 0 & 0 \end{bmatrix} \\ \mathrm{False} & \: \mathrm{otherwise} \end{array} \right.\end{split}\]- Returns:
out – Boolean equal to True if \(q_v = 0\).
- Return type:
bool
Examples
>>> q = Quaternion() >>> q Quaternion([1., 0., 0., 0.]) >>> q.is_real() True >>> q = Quaternion([0., 1., 2., 3.]) >>> q Quaternion([0. , 0.26726124, 0.53452248, 0.80178373]) >>> q.is_real() False >>> q = Quaternion([1., 2., 3., 4.]) >>> q Quaternion([0.18257419, 0.36514837, 0.54772256, 0.73029674]) >>> q.is_real() False >>> q = Quaternion([5., 0., 0., 0.]) # All quaternions are normalized, by default >>> q Quaternion([1., 0., 0., 0.]) >>> q.is_real() True