| Home | Libraries | People | FAQ | More

### Spherical Hankel Functions

##### Synopsis

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

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

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

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

##### Description

The functions sph_hankel_1 and sph_hankel_2 return the result of the spherical Hankel functions of the first and second kind respectively:

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).

##### 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

These functions are trivially implemented in terms of cyl_hankel_1 and cyl_hankel_2.