# bessel

## Purpose

Bessel functions of the first kind.

## Synopsis

    B = bessel(alpha,x)

## Description

The differential equation

is called Bessel's equation, and its solutions are known as Bessel functions.

`B = bessel(alpha x)` computes Bessel functions of the first kind, or modified Bessel functions of the first kind, for real, nonnegative `alpha` and nonnegative `x`:

- For real elements of `x` (no imaginary component), `bessel` uses the `besselj` function to compute the Bessel function of the first kind.
- For imaginary elements of `x` (no real component), `bessel` uses the `besseli` function to compute the modified Bessel function of the first kind.
- For complex elements of `x` (both real and imaginary component), `bessel` uses the `bessela` function to compute the Bessel function of the first kind.
  If `alpha` is a scalar and `x` is a vector, `B` is a vector the same length as `x`. If `x` is a vector of length `m` and `alpha` is a vector of length `n`, then `B` is an `m`-by-`n` matrix and `B(i,k)` is `bessel(alpha(k), x(i))`. The elements of `x` can be any nonnegative values, in any order. For `alpha`, the increment between elements must be 1, and all elements must be between 0 and 1000, inclusive.

  ## Examples

  Plot Bessel functions of order 0 and 1:

      x = 0:.25:10;
      plot(x,[bessel(0,x);bessel(1,x)])

  ## Algorithm

  For real `x`, `bessel` calls the function `besselj`. `besselj` evaluates the Bessel function using three-term recurrence for small-valued `x`, or an asymptotic series for large `x`. For purely complex `x`, `bessel` calls `besseli`, which uses three-term backward recurrence for most `x`, and an asymptotic expansion for large `x`. For complex `x`, `bessel` calls `bessela`, which uses either a power series or an asymptotic expansion depending on roundoff error considerations. See reference [1].

  For some values of arguments, `bessela`'s results may be severely contaminated by roundoff error. `[J,digits] = bessela(alpha,x)` returns an estimate of the number of correct significant digits in the computed result. `digits` is the `log10` of the estimated relative error, so a value of 14 or 15 corresponds to nearly full accuracy in IEEE or VAX arithmetic, while 1 or 2 indicates nearly useless results. Any negative value of digits is replaced by zero, the corresponding `J` set to `NaN` and a division by zero warning message is generated. If either `alpha` or `x` is less than 50, digits are at least 8. In the `(alpha,x)` plane, the region of least accuracy is near the line `alpha = x`, so small values of `alpha` and large values of `x`, or vice versa, give the most accurate results. For example:

      ----------------
      x   alpha  digits
      ----------------
      25  25     11.8
      25  75     14.4
      75  25     14.5
      75  75     1.9
      ----------------

  ## See Also

      besseli, besselj, besselk, bessely

  ## References

  [1] M. Abramowitz 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.

  (c) Copyright 1994 by The MathWorks, Inc.