Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Derivatives of the Bessel Functions

Synopsis

#include <boost/math/special_functions/bessel_prime.hpp>

template <class T1, class T2>
calculated-result-type cyl_bessel_j_prime(T1 v, T2 x);

template <class T1, class T2, class Policy>
calculated-result-type cyl_bessel_j_prime(T1 v, T2 x, const Policy&);

template <class T1, class T2>
calculated-result-type cyl_neumann_prime(T1 v, T2 x);

template <class T1, class T2, class Policy>
calculated-result-type cyl_neumann_prime(T1 v, T2 x, const Policy&);

template <class T1, class T2>
calculated-result-type cyl_bessel_i_prime(T1 v, T2 x);

template <class T1, class T2, class Policy>
calculated-result-type cyl_bessel_i_prime(T1 v, T2 x, const Policy&);

template <class T1, class T2>
calculated-result-type cyl_bessel_k_prime(T1 v, T2 x);

template <class T1, class T2, class Policy>
calculated-result-type cyl_bessel_k_prime(T1 v, T2 x, const Policy&);

template <class T1, class T2>
calculated-result-type sph_bessel_prime(T1 v, T2 x);

template <class T1, class T2, class Policy>
calculated-result-type sph_bessel_prime(T1 v, T2 x, const Policy&);

template <class T1, class T2>
calculated-result-type sph_neumann_prime(T1 v, T2 x);

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

These functions return the first derivative with respect to x of the corresponding Bessel function.

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.

The functions return the result of domain_error whenever the result is undefined or complex.

Testing

There are two sets of test values: spot values calculated using wolframalpha.com, and a much larger set of tests computed using a relation to the underlying Bessel functions that the implementation does not use.

Accuracy

The accuracy of these functions is broadly similar to the underlying Bessel functions.

Table 6.50. Error rates for cyl_bessel_i_prime (integer orders)

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel I'0: Mathworld Data (Integer Version)

Max = 0.885ε (Mean = 0.567ε)

Max = 0ε (Mean = 0ε)

Max = 7.83ε (Mean = 2.84ε)

Max = 6.52ε (Mean = 2.26ε)

Bessel I'1: Mathworld Data (Integer Version)

Max = 1.61ε (Mean = 0.786ε)

Max = 0ε (Mean = 0ε)

Max = 2.3ε (Mean = 1.28ε)

Max = 2.3ε (Mean = 1.29ε)

Bessel I'n: Mathworld Data (Integer Version)

Max = 3.61ε (Mean = 1.22ε)

Max = 0ε (Mean = 0ε)

Max = 2.31ε (Mean = 1.41ε)

Max = 701ε (Mean = 212ε)


Table 6.51. Error rates for cyl_bessel_i_prime

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel I'0: Mathworld Data

Max = 0.885ε (Mean = 0.567ε)

Max = 0ε (Mean = 0ε)

Max = 7.83ε (Mean = 2.84ε)

Max = 6.52ε (Mean = 2.26ε)

Bessel I'1: Mathworld Data

Max = 1.61ε (Mean = 0.786ε)

Max = 0ε (Mean = 0ε)

Max = 2.3ε (Mean = 1.28ε)

Max = 2.3ε (Mean = 1.29ε)

Bessel I'n: Mathworld Data

Max = 3.61ε (Mean = 1.22ε)

Max = 0ε (Mean = 0ε)

Max = 2.31ε (Mean = 1.41ε)

Max = 701ε (Mean = 212ε)

Bessel I'v: Mathworld Data

Max = 3.76e+003ε (Mean = 1.19e+003ε)

Max = 1.62ε (Mean = 0.512ε)

Max = 2.89e+03ε (Mean = 914ε)

Max = 2.89e+03ε (Mean = 914ε)

Bessel I'n: Random Data

Max = 9.85ε (Mean = 1.83ε)

Max = 0ε (Mean = 0ε)

Max = 6.79ε (Mean = 1.13ε)

Max = 195ε (Mean = 37.1ε)

Bessel I'v: Random Data

Max = 14ε (Mean = 2.46ε)

Max = 0ε (Mean = 0ε)

Max = 14.1ε (Mean = 2.93ε)

Max = 336ε (Mean = 68.5ε)

Bessel I'v: Mathworld Data (large values)

Max = 59.5ε (Mean = 26.8ε)

Max = 0ε (Mean = 0ε)

Max = 42.6ε (Mean = 20.2ε)

Max = 43.9ε (Mean = 20.7ε)


Table 6.52. Error rates for cyl_bessel_j_prime (integer orders)

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel J0': Mathworld Data (Integer Version)

Max = 6.62ε (Mean = 2.55ε)

Max = 0ε (Mean = 0ε)

Max = 18.9ε (Mean = 6.81ε)

Max = 18.9ε (Mean = 6.72ε)

Bessel J0': Mathworld Data (Tricky cases) (Integer Version)

Max = 3.67ε (Mean = 1.74ε)

Max = 0ε (Mean = 0ε)

Max = 8.08ε (Mean = 4.57ε)

Max = 7.44ε (Mean = 3.31ε)

Bessel J1': Mathworld Data (Integer Version)

Max = 0.999ε (Mean = 0.627ε)

Max = 0ε (Mean = 0ε)

Max = 7.9ε (Mean = 3.37ε)

Max = 7.9ε (Mean = 3.37ε)

Bessel J1': Mathworld Data (tricky cases) (Integer Version)

Max = 288ε (Mean = 129ε)

Max = 287ε (Mean = 129ε)

Max = 5.88e+05ε (Mean = 2.63e+05ε)

Max = 5.88e+05ε (Mean = 2.63e+05ε)

Bessel JN': Mathworld Data (Integer Version)

Max = 14ε (Mean = 6.13ε)

Max = 0.527ε (Mean = 0.128ε)

Max = 1.29e+03ε (Mean = 312ε)

Max = 1.29e+03ε (Mean = 355ε)


Table 6.53. Error rates for cyl_bessel_j_prime

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel J0': Mathworld Data

Max = 6.62ε (Mean = 2.55ε)

Max = 0ε (Mean = 0ε)

Max = 18.9ε (Mean = 6.81ε)

Max = 18.9ε (Mean = 6.72ε)

Bessel J0': Mathworld Data (Tricky cases)

Max = 3.67ε (Mean = 1.74ε)

Max = 0ε (Mean = 0ε)

Max = 8.08ε (Mean = 4.57ε)

Max = 7.44ε (Mean = 3.31ε)

Bessel J1': Mathworld Data

Max = 0.999ε (Mean = 0.627ε)

Max = 0ε (Mean = 0ε)

Max = 7.9ε (Mean = 3.37ε)

Max = 7.9ε (Mean = 3.37ε)

Bessel J1': Mathworld Data (tricky cases)

Max = 288ε (Mean = 129ε)

Max = 287ε (Mean = 129ε)

Max = 5.88e+05ε (Mean = 2.63e+05ε)

Max = 5.88e+05ε (Mean = 2.63e+05ε)

Bessel JN': Mathworld Data

Max = 14ε (Mean = 6.13ε)

Max = 0.527ε (Mean = 0.128ε)

Max = 1.29e+03ε (Mean = 312ε)

Max = 1.29e+03ε (Mean = 355ε)

Bessel J': Mathworld Data

Max = 23.7ε (Mean = 8.01ε)

Max = 21.5ε (Mean = 4.7ε)

Max = 42.5ε (Mean = 9.31ε)

Max = 42.5ε (Mean = 9.32ε)

Bessel J': Mathworld Data (large values)

Max = 2.9ε (Mean = 1.61ε)

Max = 0ε (Mean = 0ε)

Max = 989ε (Mean = 495ε)

Max = 989ε (Mean = 495ε)

Bessel JN': Random Data

Max = 6.34ε (Mean = 0.997ε)

Max = 0.593ε (Mean = 0.0396ε)

Max = 17.3ε (Mean = 2.47ε)

Max = 79.4ε (Mean = 16.2ε)

Bessel J': Random Data

Max = 176ε (Mean = 9.76ε)

Max = 0.885ε (Mean = 0.0457ε)

Max = 139ε (Mean = 6.47ε)

Max = 279ε (Mean = 27.2ε)

Bessel J': Random Data (Tricky large values)

Max = 379ε (Mean = 45.4ε)

Max = 0ε (Mean = 0ε)

Max = 474ε (Mean = 62.2ε)

Max = 474ε (Mean = 64.5ε)


Table 6.54. Error rates for cyl_bessel_k_prime (integer orders)

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel K'0: Mathworld Data (Integer Version)

Max = 1ε (Mean = 0.573ε)

Max = 0ε (Mean = 0ε)

Max = 1.8ε (Mean = 1.02ε)

Max = 1.8ε (Mean = 1.02ε)

Bessel K'1: Mathworld Data (Integer Version)

Max = 1.09ε (Mean = 0.607ε)

Max = 0ε (Mean = 0ε)

Max = 1.96ε (Mean = 1ε)

Max = 1.96ε (Mean = 1.04ε)

Bessel K'n: Mathworld Data (Integer Version)

Max = 4.17ε (Mean = 1.74ε)

Max = 0ε (Mean = 0ε)

Max = 4.47ε (Mean = 2.05ε)

Max = 4.47ε (Mean = 1.93ε)


Table 6.55. Error rates for cyl_bessel_k_prime

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel K'0: Mathworld Data

Max = 1ε (Mean = 0.573ε)

Max = 0ε (Mean = 0ε)

Max = 1.8ε (Mean = 1.02ε)

Max = 1.8ε (Mean = 1.02ε)

Bessel K'1: Mathworld Data

Max = 1.09ε (Mean = 0.607ε)

Max = 0ε (Mean = 0ε)

Max = 1.96ε (Mean = 1ε)

Max = 1.96ε (Mean = 1.04ε)

Bessel K'n: Mathworld Data

Max = 4.17ε (Mean = 1.74ε)

Max = 0ε (Mean = 0ε)

Max = 4.47ε (Mean = 2.05ε)

Max = 4.47ε (Mean = 1.93ε)

Bessel K'v: Mathworld Data

Max = 3.94ε (Mean = 1.43ε)

Max = 0ε (Mean = 0ε)

Max = 3.94ε (Mean = 2.49ε)

Max = 3.94ε (Mean = 2.35ε)

Bessel K'v: Mathworld Data (large values)

Max = 18.6ε (Mean = 12.1ε)

Max = 0ε (Mean = 0ε)

Max = 59.2ε (Mean = 42.9ε)

Max = 59.8ε (Mean = 43.4ε)

Bessel K'n: Random Data

Max = 8.18ε (Mean = 1.45ε)

Max = 0ε (Mean = 0ε)

Max = 4.53ε (Mean = 1.12ε)

Max = 4.45ε (Mean = 1.23ε)

Bessel K'v: Random Data

Max = 8.32ε (Mean = 1.65ε)

Max = 0ε (Mean = 0ε)

Max = 7.95ε (Mean = 1.53ε)

Max = 7.95ε (Mean = 1.55ε)


Table 6.56. Error rates for sph_bessel_prime

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

Bessel j': Random Data

Max = 307ε (Mean = 25.2ε)

Max = 0.753ε (Mean = 0.0343ε)

Max = 167ε (Mean = 12ε)

Max = 167ε (Mean = 33.2ε)


Table 6.57. Error rates for sph_neumann_prime

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

y': Random Data

Max = 296ε (Mean = 25.6ε)

Max = 0.752ε (Mean = 0.062ε)

Max = 158ε (Mean = 18.8ε)

Max = 158ε (Mean = 20.2ε)


Implementation

In the general case, the derivatives are calculated using the relations:

There are also a number of special cases, for large x we have:

And for small x:


PrevUpHomeNext