[def __R ['[*R]]]
[def __C ['[*C]]]
[def __H ['[*H]]]
[def __O ['[*O]]]
[def __R3 ['[*'''R3''']]]
[def __R4 ['[*'''R4''']]]
[def __quadrulple ('''α,β,γ,δ''')]
[def __quat_formula ['[^q = '''α + βi + γj + δk''']]]
[def __quat_complex_formula ['[^q = ('''α + βi) + (γ + δi)j''' ]]]
[def __not_equal ['[^xy '''≠''' yx]]]
[mathpart quaternions Quaternions]
[section:quat_overview Overview]
Quaternions are a relative of complex numbers.
Quaternions are in fact part of a small hierarchy of structures built
upon the real numbers, which comprise only the set of real numbers
(traditionally named __R), the set of complex numbers (traditionally named __C),
the set of quaternions (traditionally named __H) and the set of octonions
(traditionally named __O), which possess interesting mathematical properties
(chief among which is the fact that they are ['division algebras],
['i.e.] where the following property is true: if ['[^y]] is an element of that
algebra and is [*not equal to zero], then ['[^yx = yx']], where ['[^x]] and ['[^x']]
denote elements of that algebra, implies that ['[^x = x']]).
Each member of the hierarchy is a super-set of the former.
One of the most important aspects of quaternions is that they provide an
efficient way to parameterize rotations in __R3 (the usual three-dimensional space)
and __R4.
In practical terms, a quaternion is simply a quadruple of real numbers __quadrulple,
which we can write in the form __quat_formula, where ['[^i]] is the same object as for complex numbers,
and ['[^j]] and ['[^k]] are distinct objects which play essentially the same kind of role as ['[^i]].
An addition and a multiplication is defined on the set of quaternions,
which generalize their real and complex counterparts. The main novelty
here is that [*the multiplication is not commutative] (i.e. there are
quaternions ['[^x]] and ['[^y]] such that __not_equal). A good mnemotechnical way of remembering
things is by using the formula ['[^i*i = j*j = k*k = -1]].
Quaternions (and their kin) are described in far more details in this
other [@../quaternion/TQE.pdf document]
(with [@../quaternion/TQE_EA.pdf errata and addenda]).
Some traditional constructs, such as the exponential, carry over without
too much change into the realms of quaternions, but other, such as taking
a square root, do not.
[endsect] [/section:quat_overview Overview]
[section:quat_header Header File]
The interface and implementation are both supplied by the header file
[@../../../../boost/math/quaternion.hpp quaternion.hpp].
[endsect]
[section:quat_synopsis Synopsis]
namespace boost{ namespace math{
template class ``[link math_toolkit.quat quaternion]``;
template<> class ``[link math_toolkit.spec quaternion]``;
template<> class ``[link math_quaternion_double quaternion]``;
template<> class ``[link math_quaternion_long_double quaternion]``;
// operators
template quaternion ``[link math_toolkit.quat_non_mem.binary_addition_operators operator +]`` (T const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_addition_operators operator +]`` (quaternion const & lhs, T const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_addition_operators operator +]`` (::std::complex const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_addition_operators operator +]`` (quaternion const & lhs, ::std::complex const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_addition_operators operator +]`` (quaternion const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_subtraction_operators operator -]`` (T const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_subtraction_operators operator -]`` (quaternion const & lhs, T const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_subtraction_operators operator -]`` (::std::complex const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_subtraction_operators operator -]`` (quaternion const & lhs, ::std::complex const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_subtraction_operators operator -]`` (quaternion const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_multiplication_operators operator *]`` (T const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_multiplication_operators operator *]`` (quaternion const & lhs, T const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_multiplication_operators operator *]`` (::std::complex const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_multiplication_operators operator *]`` (quaternion const & lhs, ::std::complex const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_multiplication_operators operator *]`` (quaternion const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_division_operators operator /]`` (T const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_division_operators operator /]`` (quaternion const & lhs, T const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_division_operators operator /]`` (::std::complex const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_division_operators operator /]`` (quaternion const & lhs, ::std::complex const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.binary_division_operators operator /]`` (quaternion const & lhs, quaternion const & rhs);
template quaternion ``[link math_toolkit.quat_non_mem.unary_plus operator +]`` (quaternion const & q);
template quaternion ``[link math_toolkit.quat_non_mem.unary_minus operator -]`` (quaternion const & q);
template bool ``[link math_toolkit.quat_non_mem.equality_operators operator ==]`` (T const & lhs, quaternion const & rhs);
template bool ``[link math_toolkit.quat_non_mem.equality_operators operator ==]`` (quaternion const & lhs, T const & rhs);
template bool ``[link math_toolkit.quat_non_mem.equality_operators operator ==]`` (::std::complex const & lhs, quaternion const & rhs);
template bool ``[link math_toolkit.quat_non_mem.equality_operators operator ==]`` (quaternion const & lhs, ::std::complex const & rhs);
template bool ``[link math_toolkit.quat_non_mem.equality_operators operator ==]`` (quaternion const & lhs, quaternion const & rhs);
template bool ``[link math_toolkit.quat_non_mem.inequality_operators operator !=]`` (T const & lhs, quaternion const & rhs);
template bool ``[link math_toolkit.quat_non_mem.inequality_operators operator !=]`` (quaternion const & lhs, T const & rhs);
template bool ``[link math_toolkit.quat_non_mem.inequality_operators operator !=]`` (::std::complex const & lhs, quaternion const & rhs);
template bool ``[link math_toolkit.quat_non_mem.inequality_operators operator !=]`` (quaternion const & lhs, ::std::complex const & rhs);
template bool ``[link math_toolkit.quat_non_mem.inequality_operators operator !=]`` (quaternion const & lhs, quaternion const & rhs);
template
::std::basic_istream& ``[link math_toolkit.quat_non_mem.stream_extractor operator >>]`` (::std::basic_istream & is, quaternion & q);
template
::std::basic_ostream& operator ``[link math_toolkit.quat_non_mem.stream_inserter operator <<]`` (::std::basic_ostream & os, quaternion const & q);
// values
template T ``[link math_toolkit.value_op.real_and_unreal real]``(quaternion const & q);
template quaternion ``[link math_toolkit.value_op.real_and_unreal unreal]``(quaternion const & q);
template T ``[link math_toolkit.value_op.sup sup]``(quaternion const & q);
template T ``[link math_toolkit.value_op.l1 l1]``(quaternion const & q);
template T ``[link math_toolkit.value_op.abs abs]``(quaternion const & q);
template T ``[link math_toolkit.value_op.norm norm]``(quaternionconst & q);
template quaternion ``[link math_toolkit.value_op.conj conj]``(quaternion const & q);
template quaternion ``[link math_quaternions.creation_spherical]``(T const & rho, T const & theta, T const & phi1, T const & phi2);
template quaternion ``[link math_quaternions.creation_semipolar semipolar]``(T const & rho, T const & alpha, T const & theta1, T const & theta2);
template quaternion ``[link math_quaternions.creation_multipolar multipolar]``(T const & rho1, T const & theta1, T const & rho2, T const & theta2);
template quaternion ``[link math_quaternions.creation_cylindrospherical cylindrospherical]``(T const & t, T const & radius, T const & longitude, T const & latitude);
template quaternion ``[link math_quaternions.creation_cylindrical cylindrical]``(T const & r, T const & angle, T const & h1, T const & h2);
// transcendentals
template quaternion ``[link math_toolkit.trans.exp exp]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.cos cos]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.sin sin]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.tan tan]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.cosh cosh]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.sinh sinh]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.tanh tanh]``(quaternion const & q);
template quaternion ``[link math_toolkit.trans.pow pow]``(quaternion const & q, int n);
} // namespace math
} // namespace boost
[endsect] [/section:quat_header Header File]
[section:quat Template Class quaternion]
namespace boost{ namespace math{
template
class quaternion
{
public:
typedef T ``[link math_toolkit.mem_typedef value_type]``;
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T());
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(::std::complex const & z0, ::std::complex const & z1 = ::std::complex());
template
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(quaternion const & a_recopier);
T ``[link math_toolkit.quat_mem_fun.real_and_unreal_parts real]``() const;
quaternion ``[link math_toolkit.quat_mem_fun.real_and_unreal_parts unreal]``() const;
T ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_1]``() const;
T ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_2]``() const;
T ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_3]``() const;
T ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_4]``() const;
::std::complex ``[link math_toolkit.quat_mem_fun.individual_complex_components C_component_1]``() const;
::std::complex ``[link math_toolkit.quat_mem_fun.individual_complex_components C_component_2]``() const;
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(quaternion const & a_affecter);
template
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(quaternion const & a_affecter);
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(T const & a_affecter);
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(::std::complex const & a_affecter);
quaternion& ``[link math_toolkit.quat_mem_fun.addition_operators operator += ]``(T const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.addition_operators operator += ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.addition_operators operator += ]``(quaternion const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.subtraction_operators operator -= ]``(T const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.subtraction_operators operator -= ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.subtraction_operators operator -= ]``(quaternion const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.multiplication_operators operator *= ]``(T const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.multiplication_operators operator *= ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.multiplication_operators operator *= ]``(quaternion const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.division_operators operator /= ]``(T const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.division_operators operator /= ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.division_operators operator /= ]``(quaternion const & rhs);
};
} // namespace math
} // namespace boost
[endsect] [/section:quat Template Class quaternion]
[section:spec Quaternion Specializations]
namespace boost{ namespace math{
template<>
class quaternion
{
public:
typedef float ``[link math_toolkit.mem_typedef value_type]``;
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f);
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(::std::complex const & z0, ::std::complex const & z1 = ::std::complex());
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(quaternion const & a_recopier);
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(quaternion const & a_recopier);
float ``[link math_toolkit.quat_mem_fun.real_and_unreal_parts real]``() const;
quaternion ``[link math_toolkit.quat_mem_fun.real_and_unreal_parts unreal]``() const;
float ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_1]``() const;
float ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_2]``() const;
float ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_3]``() const;
float ``[link math_toolkit.quat_mem_fun.individual_real_components R_component_4]``() const;
::std::complex ``[link math_toolkit.quat_mem_fun.individual_complex_components C_component_1]``() const;
::std::complex ``[link math_toolkit.quat_mem_fun.individual_complex_components C_component_2]``() const;
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(quaternion const & a_affecter);
template
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(quaternion const & a_affecter);
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(float const & a_affecter);
quaternion& ``[link math_toolkit.quat_mem_fun.assignment_operators operator = ]``(::std::complex const & a_affecter);
quaternion& ``[link math_toolkit.quat_mem_fun.addition_operators operator += ]``(float const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.addition_operators operator += ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.addition_operators operator += ]``(quaternion const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.subtraction_operators operator -= ]``(float const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.subtraction_operators operator -= ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.subtraction_operators operator -= ]``(quaternion const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.multiplication_operators operator *= ]``(float const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.multiplication_operators operator *= ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.multiplication_operators operator *= ]``(quaternion const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.division_operators operator /= ]``(float const & rhs);
quaternion& ``[link math_toolkit.quat_mem_fun.division_operators operator /= ]``(::std::complex const & rhs);
template
quaternion& ``[link math_toolkit.quat_mem_fun.division_operators operator /= ]``(quaternion const & rhs);
};
[#math_quaternion_double]
template<>
class quaternion
{
public:
typedef double ``[link math_toolkit.mem_typedef value_type]``;
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0);
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(::std::complex const & z0, ::std::complex const & z1 = ::std::complex());
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(quaternion const & a_recopier);
explicit ``[link math_toolkit.quat_mem_fun.constructors quaternion]``(quaternion const & a_recopier);
double ``[link math_toolkit.quat_mem_fun.real_and_unreal_parts real]``() const;
quaternion