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

Cyclic Hankel Functions

Synopsis
template <class T1, class T2>
std::complex<calculated-result-type> cyl_hankel_1(T1 v, T2 x);

template <class T1, class T2, class Policy>
std::complex<calculated-result-type> cyl_hankel_1(T1 v, T2 x, const Policy&);

template <class T1, class T2>
std::complex<calculated-result-type> cyl_hankel_2(T1 v, T2 x);

template <class T1, class T2, class Policy>
std::complex<calculated-result-type> cyl_hankel_2(T1 v, T2 x, const Policy&);
Description

The functions cyl_hankel_1 and cyl_hankel_2 return the result of the Hankel functions of the first and second kind respectively:

cyl_hankel_1(v, x) = Hv(1)(x) = Jv(x) + i Yv(x)

cyl_hankel_2(v, x) = Hv(2)(x) = Jv(x) - i Yv(x)

where:

Jv(x) is the Bessel function of the first kind, and Yv(x) is the Bessel function of the second kind.

The return type of these functions is computed using the result type calculation rules when T1 and T2 are different types. The functions are also optimised for the relatively common case that T1 is an integer.

The final Policy argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the policy documentation for more details.

Note that while the arguments to these functions are real values, the results are complex. That means that the functions can only be instantiated on types float, double and long double. The functions have also been extended to operate over the whole range of v and x (unlike cyl_bessel_j and cyl_neumann).

Performance

These functions are generally more efficient than two separate calls to the underlying Bessel functions as internally Bessel J and Y can be computed simultaneously.

Testing

There are just a few spot tests to exercise all the special case handling - the bulk of the testing is done on the Bessel functions upon which these are based.

Accuracy

Refer to cyl_bessel_j and cyl_neumann.

Implementation

For x < 0 the following reflection formulae are used:

Otherwise the implementation is trivially in terms of the Bessel J and Y functions.

Note however, that the Hankel functions compute the Bessel J and Y functions simultaneously, and therefore a single Hankel function call is more efficient than two Bessel function calls. The one exception is when v is a small positive integer, in which case the usual Bessel function routines for integer order are used.


PrevUpHomeNext