📄 math-octonion.qbk
字号:
template<typename T> bool operator == (T const & lhs, octonion<T> const & rhs); template<typename T> bool operator == (octonion<T> const & lhs, T const & rhs); template<typename T> bool operator == (::std::complex<T> const & lhs, octonion<T> const & rhs); template<typename T> bool operator == (octonion<T> const & lhs, ::std::complex<T> const & rhs); template<typename T> bool operator == (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs); template<typename T> bool operator == (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs); template<typename T> bool operator == (octonion<T> const & lhs, octonion<T> const & rhs);These return true if and only if the four components of `octonion<T>(lhs)` are equal to their counterparts in `octonion<T>(rhs)`. As with any floating-type entity, this is essentially meaningless.[h4 Binary Inequality Operators] template<typename T> bool operator != (T const & lhs, octonion<T> const & rhs); template<typename T> bool operator != (octonion<T> const & lhs, T const & rhs); template<typename T> bool operator != (::std::complex<T> const & lhs, octonion<T> const & rhs); template<typename T> bool operator != (octonion<T> const & lhs, ::std::complex<T> const & rhs); template<typename T> bool operator != (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs); template<typename T> bool operator != (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs); template<typename T> bool operator != (octonion<T> const & lhs, octonion<T> const & rhs);These return true if and only if `octonion<T>(lhs) == octonion<T>(rhs)` is false. As with any floating-type entity, this is essentially meaningless.[h4 Stream Extractor] template<typename T, typename charT, class traits> ::std::basic_istream<charT,traits> & operator >> (::std::basic_istream<charT,traits> & is, octonion<T> & o);Extracts an octonion `o`. We accept any format which seems reasonable. However, since this leads to a great many ambiguities, decisions were made to lift these. In case of doubt, stick to lists of reals.The input values must be convertible to T. If bad input is encountered, calls `is.setstate(ios::failbit)` (which may throw `ios::failure` (27.4.5.3)).Returns `is`.[h4 Stream Inserter] template<typename T, typename charT, class traits> ::std::basic_ostream<charT,traits> & operator << (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);Inserts the octonion `o` onto the stream `os` as if it were implemented as follows: template<typename T, typename charT, class traits> ::std::basic_ostream<charT,traits> & operator << ( ::std::basic_ostream<charT,traits> & os, octonion<T> const & o) { ::std::basic_ostringstream<charT,traits> s; s.flags(os.flags()); s.imbue(os.getloc()); s.precision(os.precision()); s << '(' << o.R_component_1() << ',' << o.R_component_2() << ',' << o.R_component_3() << ',' << o.R_component_4() << ',' << o.R_component_5() << ',' << o.R_component_6() << ',' << o.R_component_7() << ',' << o.R_component_8() << ')'; return os << s.str(); } [endsect][section Octonion Value Operations][h4 Real and Unreal] template<typename T> T real(octonion<T> const & o); template<typename T> octonion<T> unreal(octonion<T> const & o);These return `o.real()` and `o.unreal()` respectively.[h4 conj] template<typename T> octonion<T> conj(octonion<T> const & o);This returns the conjugate of the octonion.[h4 sup] template<typename T> T sup(octonion<T> const & o);This return the sup norm (the greatest among `abs(o.R_component_1())...abs(o.R_component_8()))` of the octonion.[h4 l1] template<typename T> T l1(octonion<T> const & o);This return the l1 norm (`abs(o.R_component_1())+...+abs(o.R_component_8())`) of the octonion.[h4 abs] template<typename T> T abs(octonion<T> const & o);This return the magnitude (Euclidian norm) of the octonion.[h4 norm] template<typename T> T norm(octonion<T>const & o);This return the (Cayley) norm of the octonion. The term "norm" might be confusing, as most people associate it with the Euclidian norm (and quadratic functionals). For this version of (the mathematical objects known as) octonions, the Euclidian norm (also known as magnitude) is the square root of the Cayley norm.[endsect][section:oct_create Octonion Creation Functions] template<typename T> octonion<T> spherical(T const & rho, T const & theta, T const & phi1, T const & phi2, T const & phi3, T const & phi4, T const & phi5, T const & phi6); template<typename T> octonion<T> multipolar(T const & rho1, T const & theta1, T const & rho2, T const & theta2, T const & rho3, T const & theta3, T const & rho4, T const & theta4); template<typename T> octonion<T> cylindrical(T const & r, T const & angle, T const & h1, T const & h2, T const & h3, T const & h4, T const & h5, T const & h6);These build octonions in a way similar to the way polar builds complex numbers, as there is no strict equivalent to polar coordinates for octonions.`spherical` is a simple transposition of `polar`, it takes as inputs a (positive) magnitude and a point on the hypersphere, given by three angles. The first of these, ['theta] has a natural range of -pi to +pi, and the other two have natural ranges of -pi/2 to +pi/2 (as is the case with the usual spherical coordinates in __R3). Due to the many symmetries and periodicities, nothing untoward happens if the magnitude is negative or the angles are outside their natural ranges. The expected degeneracies (a magnitude of zero ignores the angles settings...) do happen however.`cylindrical` is likewise a simple transposition of the usual cylindrical coordinates in __R3, which in turn is another derivative of planar polar coordinates. The first two inputs are the polar coordinates of the first __C component of the octonion. The third and fourth inputs are placed into the third and fourth __R components of the octonion, respectively.`multipolar` is yet another simple generalization of polar coordinates. This time, both __C components of the octonion are given in polar coordinates.In this version of our implementation of octonions, there is no analogue of the complex value operation arg as the situation is somewhat more complicated.[endsect][section Octonions Transcendentals]There is no `log` or `sqrt` provided for octonions 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 octonions ("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. That it allows for a "closed formula" is a result of the author (the existence and definition of the exponential, on the octonions among others, on the other hand, is a few centuries old). Basically, any converging power series with real coefficients which allows for a closed formula in __C can be transposed to __O. 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 boost/math/special_functions/sinc.hpp]and the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -