The Special Functions library currently provides five templated special functions, in namespace boost. Two of these (sinc_pi
and sinhc_pi
) are needed by our implementation of quaternions and octonions.
The functions acosh
, asinh
and atanh
are entirely classical, the function sinc_pi
sees heavy use in signal processing tasks, and the function sinhc_pi
is an ad'hoc function whose naming is modelled on sinc_pi
and hyperbolic functions.
The mathematical text has been typeset with Nisus Writer, and the illustrations have been made with Graphing Calculator. Jens Maurer was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.
The interface and implementation for each function (or forms of a function) are both supplied by one header file:
The special_functions_test.cpp test program tests the functions for float, double and long double arguments (sample output, with message output enabled).
If you define the symbol BOOST_SPECIAL_FUNCTIONS_TEST_VERBOSE, you will get additional output (verbose output), which may prove useful for tuning on your platform (the library use "reasonable" tolerances, which may prove to be too strict for your platform); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...).
namespace boost
{
namespace math
{
template<typename T> inline T acosh(const T x);
template<typename T> inline T asinh(const T x);
template<typename T> inline T atanh(const T x);
template<typename T> inline T sinc_pi(const T x);
template<typename T, template<typename> class U> inline U<T> sinc_pi(const U<T> x);
template<typename T> inline T sinhc_pi(const T x);
template<typename T, template<typename> class U> inline U<T> sinhc_pi(const U<T> x);
}
}
The functions implemented here can throw standard exceptions, but no exception specification has been made.
template<typename T> inline T acosh(const T x);
Computes the reciprocal of (the restriction to the range of) the hyperbolic cosine function, at
x
. Values returned are positive. Generalised Taylor series are used near 1 and Laurent series are used near the infinity to ensure accuracy.If
x
is in the range a quiet NaN is returned (if the system allows, otherwise adomain_error
exception is generated).
template<typename T> inline T asinh(const T x);
Computes the reciprocal of the hyperbolic sine function. Taylor series are used at the origin and Laurent series are used near the infinity to ensure accuracy.
template<typename T> inline T atanh(const T x);
Computes the reciprocal of the hyperbolic tangent function, at
x
. Taylor series are used at the origin to ensure accuracy.If
x
is in the range or in the range a quiet NaN is returned (if the system allows, otherwise adomain_error
exception is generated).If
x
is in the range , minus infinity is returned (if the system allows, otherwise anout_of_range
exception is generated), with denotingnumeric_limits<T>::epsilon()
.If
x
is in the range , plus infinity is returned (if the system allows, otherwise anout_of_range
exception is generated), with denotingnumeric_limits<T>::epsilon()
.
template<typename T> inline T sinc_pi(const T x);
template<typename T, template<typename> class U> inline U<T> sinc_pi(const U<T> x);
Computes the Sinus Cardinal of
x
. The second form is for complexes, quaternions, octonions... Taylor series are used at the origin to ensure accuracy.
template<typename T> inline T sinhc_pi(const T x);
template<typename T, template<typename> class U> inline U<T> sinhc_pi(const U<T> x);
Computes the Hyperbolic Sinus Cardinal of
x
. The second form is for complexes, quaternions, octonions... Taylor series are used at the origin to ensure accuracy.
acosh
and asinh
, which were submited by Eric Ford; applied changes for Gcc 2.9.x suggested by John Maddock; improved accuracy; sanity check for test file, related to accuracy.
namespace math
.
special_functions.hpp
into atanh.hpp
, sinc.hpp
and sinhc.hpp
; improved efficiency of atanh
with compile-time technique (Daryle Walker); improved accuracy of all functions near zero (Peter Schmitteckert).
Revised 06 Feb 2003
© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.