# sphbessel_j (MathScript RT Module Function)

LabVIEW 2010 Help

Edition Date: June 2010

Part Number: 371361G-01

»View Product Info

Requires: MathScript RT Module

## Syntax

sj = sphbessel_j(v, x)

sj = sphbessel_j(v, x, 1)

[sj, error] = sphbessel_j(v, x)

[sj, error] = sphbessel_j(v, x, 1)

Legacy Name: `sphbesselj`

## Description

Computes the spherical Bessel function of the first kind of a given order.

Details

Examples

## Inputs

Name Description
v Specifies the order of the spherical Bessel function. v is a real, double-precision, floating-point positive scalar, vector, or matrix and must be integer-valued.
x Specifies the value for which you want to compute the spherical Bessel function. x is a real or complex, double-precision, floating-point scalar, vector, or matrix.
1 Scales the computation. sphbessel_j(v, x, 1) scales sphbessel_j(v, x) by exp(-abs(imag(x))).

## Outputs

Name Description
sj Returns the spherical Bessel function of the first kind. sj is a real or complex, double-precision, floating-point scalar, vector, or matrix.
error Returns error information about the evaluation of the spherical Bessel function. error is a matrix of integers in which each element can return the following values.

 0 Indicates no error occurred. 1 Indicates you specified invalid inputs. 2 Indicates the result is too large for the data type of sj. Use the scaling option 1. 3 Indicates LabVIEW achieved less than half the machine accuracy in the calculation because |x| or v is greater than approximately 1.3E8. 4 Indicates the result is meaningless because |x| or v is greater than approximately 1.8E16. 5 Indicates the calculation did not reach the termination condition, and LabVIEW did not complete the calculation.

## Details

The spherical Bessel functions are defined as particular solutions to the following equation. This equation comes from solving the Helmholtz in spherical coordinates. When you solve the Helmholtz equation in spherical coordinates using the separation of variables, the radial differential equation becomes the following equation:

x2y'' + 2xy' + [x2 - n(n + 1)]y = 0     (n = 0, ±1, ±2, ...)

Particular solutions to this equation are known as the spherical Bessel functions of the first kind, j(v, x), and second kind, y(v, x). You can write the particular solutions to this equation as functions of the following ordinary Bessel functions:

j(v, x) = sqrt(x*pi / 2)*J(v + 1/2, x)
y(v, x) = sqrt(x*pi / 2)*Y(v + 1/2, x)

The following equations define the spherical Bessel functions of the third kind, which are also known as spherical Hankel functions:

h1(v, x) = j(v, x) + i*y(v, x)
h2(v, x) = j(v, x) - i*y(v, x)

If x is a scalar, LabVIEW sets x to a vector of the same size as v whose elements all equal the value you specify in x. If v is a scalar, LabVIEW sets v to a vector of the same size as x whose elements all equal the value you specify in v. If x and v are vectors of the same orientation, LabVIEW returns a vector of spherical Bessel functions for the corresponding input values. For example, if x equals [1, 2] and v equals [3, 4], LabVIEW returns [sphbessel_j(1, 3), sphbessel_j(2, 4)]. If x and v are vectors of opposite orientation, LabVIEW returns a matrix of spherical Bessel functions for each combination of input values. For example, if x equals [1, 2] and v = [3; 4], LabVIEW returns [sphbessel_j(1, 3), sphbessel_j(1, 4); sphbessel_j(2, 3), sphbessel_j(2, 4)].

## Examples

X = [0:0.01:5];
sj0 = sphbessel_j(0, X);
sj1 = sphbessel_j(1, X);
sj2 = sphbessel_j(2, X);
plot(X, sj0, X, sj1, X, sj2);

## Related Topics

Your Feedback!  Poor  |  Excellent    Yes No
 Document Quality?