Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Quaternion Transcendentals

There is no log or sqrt provided for quaternions in this implementation, and pow is likewise restricted to integral powers of the exponent. There are several reasons to this: on the one hand, the equivalent of analytic continuation for quaternions ("branch cuts") remains to be investigated thoroughly (by me, at any rate...), and we wish to avoid the nonsense introduced in the standard by exponentiations of complexes by complexes (which is well defined, but not in the standard...). Talking of nonsense, saying that pow(0,0) is "implementation defined" is just plain brain-dead...

We do, however provide several transcendentals, chief among which is the exponential. This author claims the complete proof of the "closed formula" as his own, as well as its independant invention (there are claims to prior invention of the formula, such as one by Professor Shoemake, and it is possible that the formula had been known a couple of centuries back, but in absence of bibliographical reference, the matter is pending, awaiting further investigation; on the other hand, the definition and existence of the exponential on the quaternions, is of course a fact known for a very long time). Basically, any converging power series with real coefficients which allows for a closed formula in C can be transposed to H. More transcendentals of this type could be added in a further revision upon request. It should be noted that it is these functions which force the dependency upon the boost/math/special_functions/sinc.hpp and the boost/math/special_functions/sinhc.hpp headers.

exp
template<typename T> quaternion<T> exp(quaternion<T> const & q);

Computes the exponential of the quaternion.

cos
template<typename T> quaternion<T>  cos(quaternion<T> const & q);

Computes the cosine of the quaternion

sin
template<typename T> quaternion<T>  sin(quaternion<T> const & q);

Computes the sine of the quaternion.

tan
template<typename T> quaternion<T>  tan(quaternion<T> const & q);

Computes the tangent of the quaternion.

cosh
template<typename T> quaternion<T>  cosh(quaternion<T> const & q);

Computes the hyperbolic cosine of the quaternion.

sinh
template<typename T> quaternion<T>  sinh(quaternion<T> const & q);

Computes the hyperbolic sine of the quaternion.

tanh
template<typename T> quaternion<T>  tanh(quaternion<T> const & q);

Computes the hyperbolic tangent of the quaternion.

pow
template<typename T> quaternion<T>  pow(quaternion<T> const & q, int n);

Computes the n-th power of the quaternion q.


PrevUpHomeNext