Accelerating the pace of engineering and science

# bessely

Bessel function of second kind

## Syntax

Y = bessely(nu,Z)
Y = bessely(nu,Z,1)

## Definitions

The differential equation

${z}^{2}\frac{{d}^{2}y}{d{z}^{2}}+z\frac{dy}{dz}+\left({z}^{2}-{\nu }^{2}\right)y=0,$

where ν is a real constant, is called Bessel's equation, and its solutions are known as Bessel functions.

A solution Yν(z) of the second kind can be expressed as

${Y}_{\nu }\left(z\right)=\frac{{J}_{\nu }\left(z\right)\mathrm{cos}\left(\nu \pi \right)-{J}_{-\nu }\left(z\right)}{\mathrm{sin}\left(\nu \pi \right)}$

where Jν(z) and Jν(z) form a fundamental set of solutions of Bessel's equation for noninteger ν

${J}_{v}\left(z\right)={\left(\frac{z}{2}\right)}^{\nu }\sum _{k=0}^{\infty }\frac{{\left(-\frac{{z}^{2}}{4}\right)}^{k}}{k!\Gamma \left(\nu +k+1\right)},$

and Γ(a) is the gamma function. Yν(z) is linearly independent of Jν(z).

Jν(z) can be computed using besselj.

## Description

Y = bessely(nu,Z) computes Bessel functions of the second kind, Yν(z), for each element of the array Z. The order nu need not be an integer, but must be real. The argument Z can be complex. The result is real where Z is positive.

If nu and Z are arrays of the same size, the result is also that size. If either input is a scalar, it is expanded to the other input's size.

Y = bessely(nu,Z,1) computes bessely(nu,Z).*exp(-abs(imag(Z))).

## Examples

expand all

### Vector of Function Values

Create a column vector of domain values.

```z = (0:0.2:1)';
```

Calculate the function values using bessely with nu = 1.

```format long
bessely(1,z)
```
```ans =

-Inf
-3.323824988111848
-1.780872044270052
-1.260391347177388
-0.978144176683359
-0.781212821300289```

### Plot Bessel Functions of Second Kind

Define the domain.

```X = 0:0.1:20;
```

Calculate the first five Bessel functions of the second kind.

```Y = zeros(5,201);
for i = 0:4
Y(i+1,:) = bessely(i,X);
end
```

Plot the results.

```plot(X,Y,'LineWidth',1.5)
axis([-0.1 20.2 -2 0.6])
grid on
legend('Y_0','Y_1','Y_2','Y_3','Y_4','Location','Best')
title('Bessel Functions of the Second Kind for v = 0,1,2,3,4')
xlabel('X')
ylabel('Y_v(X)')
```

expand all

### Tips

The Bessel functions are related to the Hankel functions, also called Bessel functions of the third kind,

$\begin{array}{l}{H}_{\nu }^{\left(1\right)}\left(z\right)={J}_{\nu }\left(z\right)+i\text{\hspace{0.17em}}{Y}_{\nu }\left(z\right)\\ {H}_{\nu }^{\left(2\right)}\left(z\right)={J}_{\nu }\left(z\right)-i\text{\hspace{0.17em}}{Y}_{\nu }\left(z\right),\end{array}$

where ${H}_{\nu }^{\left(K\right)}\left(z\right)$ is besselh, Jν(z) is besselj, and Yν(z) is bessely. The Hankel functions also form a fundamental set of solutions to Bessel's equation (see besselh).

### Algorithms

The bessely function uses a Fortran MEX-file to call a library developed by D. E Amos [3] [4].

## References

[1] Abramowitz, M., and I.A. Stegun, Handbook of Mathematical Functions, National Bureau of Standards, Applied Math. Series #55, Dover Publications, 1965, sections 9.1.1, 9.1.89, and 9.12, formulas 9.1.10 and 9.2.5.

[2] Carrier, Krook, and Pearson, Functions of a Complex Variable: Theory and Technique, Hod Books, 1983, section 5.5.

[3] Amos, D.E., "A Subroutine Package for Bessel Functions of a Complex Argument and Nonnegative Order," Sandia National Laboratory Report, SAND85-1018, May, 1985.

[4] Amos, D.E., "A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order," Trans. Math. Software, 1986.