E.V.E
v2022.03.00

◆ cyl_bessel_kn

eve::cyl_bessel_kn = {}
inlineconstexpr

Computes the modified Bessel function of the second kind, \( K_n(x)=\frac{\Gamma(n+1/2)(2x)^n}{\sqrt\pi} \int_{0}^{\infty}\frac{\cos\tau} {(\tau^2+x^2)^{n+1/2}}\,\mathrm{d}\tau\).

It is the solution of \( x^{2}y''+xy'-(x^2+n^2)y=0\) for which \( y(0) = \infty\).

Defined in header

#include <eve/module/bessel.hpp>

Callable Signatures

namespace eve
{
template< eve::real_value N, eve::floating_real_value T >
T cyl_bessel_kn(N n, T x) noexcept;
}
constexpr callable_cyl_bessel_kn_ cyl_bessel_kn
Computes the modified Bessel function of the second kind, .
Definition: cyl_bessel_kn.hpp:56
Definition: all_of.hpp:22

Parameters

  • n: order of the function (non necessarily integral)
  • x : real floating argument.

Return value

The value of \(\displaystyle K_n(x)=\frac{\Gamma(n+1/2)(2x)^n}{\sqrt\pi} \int_{0}^{\infty}\frac{\cos\tau}{(\tau^2+x^2)^{n+1/2}}\,\mathrm{d}\tau\) is returned.

Example

#include <eve/module/bessel.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft x = {0.5, 1.5, 0.1, 1.0, 19.0, 25.0, 21.5, 10000.0};
wide_ft n = {0.5, -1.0, 1.5, -2.0, 2.5, -2.6, 3.2, -12};
std::cout << "---- simd" << '\n'
<< "<- n = " << n << '\n'
<< "<- x = " << x << '\n'
<< "-> cyl_bessel_kn(pf) = " << eve::cyl_bessel_kn(n, x) << '\n'
;
double xd = 1.0;
std::cout << "---- scalar" << '\n'
<< "<- xd = " << xd << '\n'
<< "-> cyl_bessel_kn(3, xd) = " << eve::cyl_bessel_kn(3, xd) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65