SPHERICAL_IN

The modified spherical Bessel function of the first kind, i_n(z), is used in spherical problems with exponentially growing or decaying radial behavior.

It is related to the modified cylindrical Bessel function by:

i_n(z) = \sqrt{\frac{\pi}{2z}}\,I_{n+1/2}(z)

This function evaluates either i_n(z) or its derivative depending on the derivative flag.

Excel Usage

=SPHERICAL_IN(n, z, derivative)
  • n (int, required): Nonnegative integer order of the modified spherical Bessel function (dimensionless).
  • z (float, required): Argument where the function is evaluated (dimensionless).
  • derivative (bool, optional, default: false): Whether to return the derivative instead of the function value (true or false).

Returns (float): Value of the modified spherical Bessel function of the first kind (or derivative).

Example 1: Zero order function value

Inputs:

n z derivative
0 1 false

Excel formula:

=SPHERICAL_IN(0, 1, FALSE)

Expected output:

1.1752

Example 2: First order function value

Inputs:

n z derivative
1 2 false

Excel formula:

=SPHERICAL_IN(1, 2, FALSE)

Expected output:

0.974383

Example 3: Second order derivative value

Inputs:

n z derivative
2 1.5 true

Excel formula:

=SPHERICAL_IN(2, 1.5, TRUE)

Expected output:

0.270594

Example 4: Third order at moderate argument

Inputs:

n z derivative
3 2.5 false

Excel formula:

=SPHERICAL_IN(3, 2.5, FALSE)

Expected output:

0.208439

Python Code

from scipy.special import spherical_in as scipy_spherical_in

def spherical_in(n, z, derivative=False):
    """
    Compute the modified spherical Bessel function of the first kind or its derivative.

    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.spherical_in.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        n (int): Nonnegative integer order of the modified spherical Bessel function (dimensionless).
        z (float): Argument where the function is evaluated (dimensionless).
        derivative (bool, optional): Whether to return the derivative instead of the function value (true or false). Default is False.

    Returns:
        float: Value of the modified spherical Bessel function of the first kind (or derivative).
    """
    try:
        n = int(n)
        z = float(z)
        derivative = bool(derivative)
        if n < 0:
            return "Error: n must be greater than or equal to 0"
        return float(scipy_spherical_in(n, z, derivative=derivative))
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Nonnegative integer order of the modified spherical Bessel function (dimensionless).
Argument where the function is evaluated (dimensionless).
Whether to return the derivative instead of the function value (true or false).