Bessel Functions
Overview
Bessel functions are canonical solutions to radial differential equations that arise in cylindrical and spherical geometries. In data analysis and engineering models, Bessel-function families appear whenever symmetry reduces a PDE to an ODE in radius, such as wave propagation, diffusion, heat flow, and vibration problems. They matter because many physically realistic boundary-value problems are solved either directly with these functions or with roots and asymptotic forms derived from them. This category provides practical evaluators for the most-used cylindrical and spherical Bessel variants.
The unifying ideas are the distinctions between oscillatory vs. exponentially scaled behavior, ordinary vs. modified forms, and cylindrical vs. spherical coordinate systems. Ordinary cylindrical functions satisfy x^2 y'' + x y' + (x^2-\nu^2)y = 0, with first-kind J_\nu and second-kind Y_\nu solutions, while modified functions I_\nu and K_\nu govern hyperbolic-growth/decay analogs. Complex radiation behavior is represented by Hankel combinations H_\nu^{(1)} = J_\nu + iY_\nu and H_\nu^{(2)} = J_\nu - iY_\nu. In practice, zeros of selected families determine resonant modes and eigenvalues for constrained domains.
Implementation: These tools are powered by SciPy Special, primarily the scipy.special module. SciPy provides numerically robust implementations of special functions used across scientific computing, optimization, and simulation workflows.
The cylindrical wave-function set covers direct evaluation of ordinary and Hankel forms: BESSEL_JV, BESSEL_YV, BESSEL_HANKEL1, and BESSEL_HANKEL2. Together, these functions support frequency-domain modeling of outward and inward cylindrical waves, acoustic/EM scattering approximations, and Green’s-function style formulations. The Hankel pair is especially useful when imposing radiation conditions in 2D wave problems, while J_\nu and Y_\nu often appear in separated solutions with mixed boundary constraints.
The modified and spectral-constraint tools focus on growth/decay regimes and modal roots. BESSEL_IV and BESSEL_KV are used in diffusion-like, screened-potential, and evanescent-field models where modified Bessel behavior is physically appropriate. BESSEL_JN_ZEROS and BESSEL_YN_ZEROS return ordered roots needed for eigenfunction expansions, resonance calculations, and finite-domain boundary matching in cylindrical systems. These root finders are often the bridge between closed-form theory and numerically parameterized design equations.
The spherical radial-function tools provide the analogous family for 3D radial symmetry: SPHERICAL_JN, SPHERICAL_YN, SPHERICAL_IN, and SPHERICAL_KN. They are central in partial-wave methods, quantum and acoustic radial equations, and spherical heat/mass transfer approximations where angular dependence is separated via harmonics. Using this set alongside cylindrical functions allows analysts to move consistently between geometry classes while preserving physically meaningful boundary behavior.
BESSEL_HANKEL1
The Hankel function of the first kind, H_v^{(1)}(z), combines Bessel functions as H_v^{(1)} = J_v + iY_v and represents outward-propagating cylindrical waves.
Because this function is generally complex-valued, the result is returned as a 2D array containing real and imaginary parts.
H_v^{(1)}(z) = J_v(z) + iY_v(z)
Excel Usage
=BESSEL_HANKEL1(v, z)
v(float, required): Order of the Hankel function (dimensionless).z(float, required): Argument where the function is evaluated (dimensionless).
Returns (list[list]): One-row array with real and imaginary parts as [[real, imag]].
Example 1: Zero order at unit argument
Inputs:
| v | z |
|---|---|
| 0 | 1 |
Excel formula:
=BESSEL_HANKEL1(0, 1)
Expected output:
| Result | |
|---|---|
| 0.765198 | 0.088257 |
Example 2: First order at moderate argument
Inputs:
| v | z |
|---|---|
| 1 | 2 |
Excel formula:
=BESSEL_HANKEL1(1, 2)
Expected output:
| Result | |
|---|---|
| 0.576725 | -0.107032 |
Example 3: Half order at positive argument
Inputs:
| v | z |
|---|---|
| 0.5 | 3 |
Excel formula:
=BESSEL_HANKEL1(0.5, 3)
Expected output:
| Result | |
|---|---|
| 0.0650082 | 0.456049 |
Example 4: Second order at larger argument
Inputs:
| v | z |
|---|---|
| 2 | 5 |
Excel formula:
=BESSEL_HANKEL1(2, 5)
Expected output:
| Result | |
|---|---|
| 0.0465651 | 0.367663 |
Python Code
Show Code
from scipy.special import hankel1 as scipy_hankel1
def bessel_hankel1(v, z):
"""
Compute the cylindrical Hankel function of the first kind and return real and imaginary parts.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.hankel1.html
This example function is provided as-is without any representation of accuracy.
Args:
v (float): Order of the Hankel function (dimensionless).
z (float): Argument where the function is evaluated (dimensionless).
Returns:
list[list]: One-row array with real and imaginary parts as [[real, imag]].
"""
try:
v = float(v)
z = float(z)
result = scipy_hankel1(v, z)
return [[float(result.real), float(result.imag)]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_HANKEL2
The Hankel function of the second kind, H_v^{(2)}(z), combines Bessel functions as H_v^{(2)} = J_v - iY_v and represents inward-propagating cylindrical waves.
Because this function is generally complex-valued, the result is returned as a 2D array containing real and imaginary parts.
H_v^{(2)}(z) = J_v(z) - iY_v(z)
Excel Usage
=BESSEL_HANKEL2(v, z)
v(float, required): Order of the Hankel function (dimensionless).z(float, required): Argument where the function is evaluated (dimensionless).
Returns (list[list]): One-row array with real and imaginary parts as [[real, imag]].
Example 1: Zero order at unit argument
Inputs:
| v | z |
|---|---|
| 0 | 1 |
Excel formula:
=BESSEL_HANKEL2(0, 1)
Expected output:
| Result | |
|---|---|
| 0.765198 | -0.088257 |
Example 2: First order at moderate argument
Inputs:
| v | z |
|---|---|
| 1 | 2 |
Excel formula:
=BESSEL_HANKEL2(1, 2)
Expected output:
| Result | |
|---|---|
| 0.576725 | 0.107032 |
Example 3: Half order at positive argument
Inputs:
| v | z |
|---|---|
| 0.5 | 3 |
Excel formula:
=BESSEL_HANKEL2(0.5, 3)
Expected output:
| Result | |
|---|---|
| 0.0650082 | -0.456049 |
Example 4: Second order at larger argument
Inputs:
| v | z |
|---|---|
| 2 | 5 |
Excel formula:
=BESSEL_HANKEL2(2, 5)
Expected output:
| Result | |
|---|---|
| 0.0465651 | -0.367663 |
Python Code
Show Code
from scipy.special import hankel2 as scipy_hankel2
def bessel_hankel2(v, z):
"""
Compute the cylindrical Hankel function of the second kind and return real and imaginary parts.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.hankel2.html
This example function is provided as-is without any representation of accuracy.
Args:
v (float): Order of the Hankel function (dimensionless).
z (float): Argument where the function is evaluated (dimensionless).
Returns:
list[list]: One-row array with real and imaginary parts as [[real, imag]].
"""
try:
v = float(v)
z = float(z)
result = scipy_hankel2(v, z)
return [[float(result.real), float(result.imag)]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_IV
The modified cylindrical Bessel function of the first kind, I_v(z), solves the modified Bessel equation and grows exponentially for large positive arguments. It is used in diffusion, heat transfer, and radial problems with hyperbolic behavior.
This function evaluates I_v(z) for real order v and real argument z.
z^2 y'' + z y' - (z^2 + v^2)y = 0
where one standard solution is y = I_v(z).
Excel Usage
=BESSEL_IV(v, z)
v(float, required): Order of the modified Bessel function (dimensionless).z(float, required): Argument where the function is evaluated (dimensionless).
Returns (float): Value of the modified Bessel function of the first kind at the specified order and argument.
Example 1: Zero order at unit argument
Inputs:
| v | z |
|---|---|
| 0 | 1 |
Excel formula:
=BESSEL_IV(0, 1)
Expected output:
1.26607
Example 2: First order at positive argument
Inputs:
| v | z |
|---|---|
| 1 | 2 |
Excel formula:
=BESSEL_IV(1, 2)
Expected output:
1.59064
Example 3: Half order at moderate argument
Inputs:
| v | z |
|---|---|
| 0.5 | 1.5 |
Excel formula:
=BESSEL_IV(0.5, 1.5)
Expected output:
1.38716
Example 4: Second order at negative argument
Inputs:
| v | z |
|---|---|
| 2 | -1 |
Excel formula:
=BESSEL_IV(2, -1)
Expected output:
0.135748
Python Code
Show Code
from scipy.special import iv as scipy_iv
def bessel_iv(v, z):
"""
Compute the modified cylindrical Bessel function of the first kind for real order.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.iv.html
This example function is provided as-is without any representation of accuracy.
Args:
v (float): Order of the modified Bessel function (dimensionless).
z (float): Argument where the function is evaluated (dimensionless).
Returns:
float: Value of the modified Bessel function of the first kind at the specified order and argument.
"""
try:
v = float(v)
z = float(z)
return float(scipy_iv(v, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_JN_ZEROS
This function computes the first nt positive roots of J_n(x) for integer order n. The roots are returned in ascending order and exclude the root at x=0 for n>0.
These roots satisfy:
J_n(x_k) = 0, \quad x_k > 0, \quad k=1,2,\dots,nt
The result is returned as a single-row 2D array for Excel range compatibility.
Excel Usage
=BESSEL_JN_ZEROS(n, nt)
n(int, required): Nonnegative integer order of the Bessel function (dimensionless).nt(int, required): Number of positive roots to return (count).
Returns (list[list]): Single-row array containing the first nt positive roots of J_n.
Example 1: First four roots for order zero
Inputs:
| n | nt |
|---|---|
| 0 | 4 |
Excel formula:
=BESSEL_JN_ZEROS(0, 4)
Expected output:
| Result | |||
|---|---|---|---|
| 2.40483 | 5.52008 | 8.65373 | 11.7915 |
Example 2: First three roots for order one
Inputs:
| n | nt |
|---|---|
| 1 | 3 |
Excel formula:
=BESSEL_JN_ZEROS(1, 3)
Expected output:
| Result | ||
|---|---|---|
| 3.83171 | 7.01559 | 10.1735 |
Example 3: First five roots for order two
Inputs:
| n | nt |
|---|---|
| 2 | 5 |
Excel formula:
=BESSEL_JN_ZEROS(2, 5)
Expected output:
| Result | ||||
|---|---|---|---|---|
| 5.13562 | 8.41724 | 11.6198 | 14.796 | 17.9598 |
Example 4: First two roots for order four
Inputs:
| n | nt |
|---|---|
| 4 | 2 |
Excel formula:
=BESSEL_JN_ZEROS(4, 2)
Expected output:
| Result | |
|---|---|
| 7.58834 | 11.0647 |
Python Code
Show Code
from scipy.special import jn_zeros as scipy_jn_zeros
def bessel_jn_zeros(n, nt):
"""
Compute the first positive zeros of the integer-order Bessel function of the first kind.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.jn_zeros.html
This example function is provided as-is without any representation of accuracy.
Args:
n (int): Nonnegative integer order of the Bessel function (dimensionless).
nt (int): Number of positive roots to return (count).
Returns:
list[list]: Single-row array containing the first nt positive roots of J_n.
"""
try:
n = int(n)
nt = int(nt)
if n < 0:
return "Error: n must be greater than or equal to 0"
if nt <= 0:
return "Error: nt must be greater than 0"
roots = scipy_jn_zeros(n, nt)
return [[float(x) for x in roots.tolist()]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_JV
The cylindrical Bessel function of the first kind, J_v(z), is a solution to Bessel’s differential equation that remains finite at the origin for nonnegative integer order. It appears in wave, heat, and vibration problems with cylindrical symmetry.
This function evaluates J_v(z) for real order v and real argument z by calling SciPy’s implementation.
z^2 y'' + z y' + (z^2 - v^2)y = 0
where one regular solution is y = J_v(z).
Excel Usage
=BESSEL_JV(v, z)
v(float, required): Order of the Bessel function (dimensionless).z(float, required): Argument where the function is evaluated (dimensionless).
Returns (float): Value of the Bessel function of the first kind at the specified order and argument.
Example 1: Order zero at unit argument
Inputs:
| v | z |
|---|---|
| 0 | 1 |
Excel formula:
=BESSEL_JV(0, 1)
Expected output:
0.765198
Example 2: First order at moderate argument
Inputs:
| v | z |
|---|---|
| 1 | 2.5 |
Excel formula:
=BESSEL_JV(1, 2.5)
Expected output:
0.497094
Example 3: Fractional order evaluation
Inputs:
| v | z |
|---|---|
| 0.5 | 3 |
Excel formula:
=BESSEL_JV(0.5, 3)
Expected output:
0.0650082
Example 4: Negative integer order
Inputs:
| v | z |
|---|---|
| -1 | 2 |
Excel formula:
=BESSEL_JV(-1, 2)
Expected output:
-0.576725
Python Code
Show Code
from scipy.special import jv as scipy_jv
def bessel_jv(v, z):
"""
Compute the cylindrical Bessel function of the first kind for real order.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.jv.html
This example function is provided as-is without any representation of accuracy.
Args:
v (float): Order of the Bessel function (dimensionless).
z (float): Argument where the function is evaluated (dimensionless).
Returns:
float: Value of the Bessel function of the first kind at the specified order and argument.
"""
try:
v = float(v)
z = float(z)
return float(scipy_jv(v, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_KV
The modified cylindrical Bessel function of the second kind, K_v(z), is a decaying solution of the modified Bessel equation and is frequently used for radial decay and boundary-layer behavior.
This function evaluates K_v(z) for real order v and positive real argument z.
z^2 y'' + z y' - (z^2 + v^2)y = 0
where one decaying solution is y = K_v(z).
Excel Usage
=BESSEL_KV(v, z)
v(float, required): Order of the modified Bessel function (dimensionless).z(float, required): Positive argument where the function is evaluated (dimensionless).
Returns (float): Value of the modified Bessel function of the second kind at the specified order and argument.
Example 1: Zero order at unit argument
Inputs:
| v | z |
|---|---|
| 0 | 1 |
Excel formula:
=BESSEL_KV(0, 1)
Expected output:
0.421024
Example 2: First order at small positive argument
Inputs:
| v | z |
|---|---|
| 1 | 0.8 |
Excel formula:
=BESSEL_KV(1, 0.8)
Expected output:
0.861782
Example 3: Half order at moderate argument
Inputs:
| v | z |
|---|---|
| 0.5 | 2 |
Excel formula:
=BESSEL_KV(0.5, 2)
Expected output:
0.119938
Example 4: Second order at larger argument
Inputs:
| v | z |
|---|---|
| 2 | 4 |
Excel formula:
=BESSEL_KV(2, 4)
Expected output:
0.0174014
Python Code
Show Code
from scipy.special import kv as scipy_kv
def bessel_kv(v, z):
"""
Compute the modified cylindrical Bessel function of the second kind for real order.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.kv.html
This example function is provided as-is without any representation of accuracy.
Args:
v (float): Order of the modified Bessel function (dimensionless).
z (float): Positive argument where the function is evaluated (dimensionless).
Returns:
float: Value of the modified Bessel function of the second kind at the specified order and argument.
"""
try:
v = float(v)
z = float(z)
if z <= 0:
return "Error: z must be greater than 0 for real-valued output"
return float(scipy_kv(v, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_YN_ZEROS
This function computes the first nt positive roots of Y_n(x) for integer order n. The roots are returned in ascending order.
These roots satisfy:
Y_n(x_k) = 0, \quad x_k > 0, \quad k=1,2,\dots,nt
The result is returned as a single-row 2D array for Excel range compatibility.
Excel Usage
=BESSEL_YN_ZEROS(n, nt)
n(int, required): Nonnegative integer order of the Bessel function (dimensionless).nt(int, required): Number of positive roots to return (count).
Returns (list[list]): Single-row array containing the first nt positive roots of Y_n.
Example 1: First four roots for order zero
Inputs:
| n | nt |
|---|---|
| 0 | 4 |
Excel formula:
=BESSEL_YN_ZEROS(0, 4)
Expected output:
| Result | |||
|---|---|---|---|
| 0.893577 | 3.95768 | 7.08605 | 10.2223 |
Example 2: First three roots for order one
Inputs:
| n | nt |
|---|---|
| 1 | 3 |
Excel formula:
=BESSEL_YN_ZEROS(1, 3)
Expected output:
| Result | ||
|---|---|---|
| 2.19714 | 5.42968 | 8.59601 |
Example 3: First five roots for order two
Inputs:
| n | nt |
|---|---|
| 2 | 5 |
Excel formula:
=BESSEL_YN_ZEROS(2, 5)
Expected output:
| Result | ||||
|---|---|---|---|---|
| 3.38424 | 6.79381 | 10.0235 | 13.21 | 16.379 |
Example 4: First two roots for order four
Inputs:
| n | nt |
|---|---|
| 4 | 2 |
Excel formula:
=BESSEL_YN_ZEROS(4, 2)
Expected output:
| Result | |
|---|---|
| 5.64515 | 9.36162 |
Python Code
Show Code
from scipy.special import yn_zeros as scipy_yn_zeros
def bessel_yn_zeros(n, nt):
"""
Compute the first positive zeros of the integer-order Bessel function of the second kind.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.yn_zeros.html
This example function is provided as-is without any representation of accuracy.
Args:
n (int): Nonnegative integer order of the Bessel function (dimensionless).
nt (int): Number of positive roots to return (count).
Returns:
list[list]: Single-row array containing the first nt positive roots of Y_n.
"""
try:
n = int(n)
nt = int(nt)
if n < 0:
return "Error: n must be greater than or equal to 0"
if nt <= 0:
return "Error: nt must be greater than 0"
roots = scipy_yn_zeros(n, nt)
return [[float(x) for x in roots.tolist()]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BESSEL_YV
The cylindrical Bessel function of the second kind, Y_v(z), is the second linearly independent solution of Bessel’s differential equation. It is commonly used together with J_v(z) in cylindrical boundary-value and wave-radiation problems.
This function evaluates Y_v(z) for real order v and real argument z.
z^2 y'' + z y' + (z^2 - v^2)y = 0
where one singular solution is y = Y_v(z).
Excel Usage
=BESSEL_YV(v, z)
v(float, required): Order of the Bessel function (dimensionless).z(float, required): Positive argument where the function is evaluated (dimensionless).
Returns (float): Value of the Bessel function of the second kind at the specified order and argument.
Example 1: Zero order at unit argument
Inputs:
| v | z |
|---|---|
| 0 | 1 |
Excel formula:
=BESSEL_YV(0, 1)
Expected output:
0.088257
Example 2: First order at small positive argument
Inputs:
| v | z |
|---|---|
| 1 | 0.75 |
Excel formula:
=BESSEL_YV(1, 0.75)
Expected output:
-1.03759
Example 3: Fractional order evaluation
Inputs:
| v | z |
|---|---|
| 1.5 | 2 |
Excel formula:
=BESSEL_YV(1.5, 2)
Expected output:
-0.395623
Example 4: Second order at larger argument
Inputs:
| v | z |
|---|---|
| 2 | 5 |
Excel formula:
=BESSEL_YV(2, 5)
Expected output:
0.367663
Python Code
Show Code
from scipy.special import yv as scipy_yv
def bessel_yv(v, z):
"""
Compute the cylindrical Bessel function of the second kind for real order.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.yv.html
This example function is provided as-is without any representation of accuracy.
Args:
v (float): Order of the Bessel function (dimensionless).
z (float): Positive argument where the function is evaluated (dimensionless).
Returns:
float: Value of the Bessel function of the second kind at the specified order and argument.
"""
try:
v = float(v)
z = float(z)
if z <= 0:
return "Error: z must be greater than 0 for real-valued output"
return float(scipy_yv(v, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
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
Show 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
SPHERICAL_JN
The spherical Bessel function of the first kind, j_n(z), is commonly used in radial wave equations in spherical coordinates.
It is related to the cylindrical Bessel function by:
j_n(z) = \sqrt{\frac{\pi}{2z}}\,J_{n+1/2}(z)
This function evaluates either j_n(z) or its derivative depending on the derivative flag.
Excel Usage
=SPHERICAL_JN(n, z, derivative)
n(int, required): Nonnegative integer order of the 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 spherical Bessel function (or derivative) at order n and argument z.
Example 1: Zero order function value
Inputs:
| n | z | derivative |
|---|---|---|
| 0 | 1 | false |
Excel formula:
=SPHERICAL_JN(0, 1, FALSE)
Expected output:
0.841471
Example 2: First order function value
Inputs:
| n | z | derivative |
|---|---|---|
| 1 | 2 | false |
Excel formula:
=SPHERICAL_JN(1, 2, FALSE)
Expected output:
0.435398
Example 3: Second order derivative value
Inputs:
| n | z | derivative |
|---|---|---|
| 2 | 1.5 | true |
Excel formula:
=SPHERICAL_JN(2, 1.5, TRUE)
Expected output:
0.141474
Example 4: Third order at moderate argument
Inputs:
| n | z | derivative |
|---|---|---|
| 3 | 4 | false |
Excel formula:
=SPHERICAL_JN(3, 4, FALSE)
Expected output:
0.229244
Python Code
Show Code
from scipy.special import spherical_jn as scipy_spherical_jn
def spherical_jn(n, z, derivative=False):
"""
Compute the spherical Bessel function of the first kind or its derivative.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.spherical_jn.html
This example function is provided as-is without any representation of accuracy.
Args:
n (int): Nonnegative integer order of the 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 spherical Bessel function (or derivative) at order n and argument z.
"""
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_jn(n, z, derivative=derivative))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
SPHERICAL_KN
The modified spherical Bessel function of the second kind, k_n(z), is a decaying spherical solution used in screened or evanescent radial fields.
It is related to the modified cylindrical Bessel function by:
k_n(z) = \sqrt{\frac{\pi}{2z}}\,K_{n+1/2}(z)
This function evaluates either k_n(z) or its derivative depending on the derivative flag.
Excel Usage
=SPHERICAL_KN(n, z, derivative)
n(int, required): Nonnegative integer order of the modified spherical Bessel function (dimensionless).z(float, required): Positive 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 second kind (or derivative).
Example 1: Zero order function value
Inputs:
| n | z | derivative |
|---|---|---|
| 0 | 1 | false |
Excel formula:
=SPHERICAL_KN(0, 1, FALSE)
Expected output:
0.577864
Example 2: First order function value
Inputs:
| n | z | derivative |
|---|---|---|
| 1 | 2 | false |
Excel formula:
=SPHERICAL_KN(1, 2, FALSE)
Expected output:
0.159438
Example 3: Second order derivative value
Inputs:
| n | z | derivative |
|---|---|---|
| 2 | 1.5 | true |
Excel formula:
=SPHERICAL_KN(2, 1.5, TRUE)
Expected output:
-2.4145
Example 4: Third order at moderate argument
Inputs:
| n | z | derivative |
|---|---|---|
| 3 | 2.5 | false |
Excel formula:
=SPHERICAL_KN(3, 2.5, FALSE)
Expected output:
0.348651
Python Code
Show Code
from scipy.special import spherical_kn as scipy_spherical_kn
def spherical_kn(n, z, derivative=False):
"""
Compute the modified spherical Bessel function of the second kind or its derivative.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.spherical_kn.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): Positive 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 second 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"
if z <= 0:
return "Error: z must be greater than 0 for real-valued output"
return float(scipy_spherical_kn(n, z, derivative=derivative))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
SPHERICAL_YN
The spherical Bessel function of the second kind, y_n(z), is the second independent spherical solution paired with j_n(z) in radial problems.
It is related to the cylindrical Bessel function by:
y_n(z) = \sqrt{\frac{\pi}{2z}}\,Y_{n+1/2}(z)
This function evaluates either y_n(z) or its derivative depending on the derivative flag.
Excel Usage
=SPHERICAL_YN(n, z, derivative)
n(int, required): Nonnegative integer order of the spherical Bessel function (dimensionless).z(float, required): Positive 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 spherical Bessel function of the second kind (or derivative) at order n and argument z.
Example 1: Zero order function value
Inputs:
| n | z | derivative |
|---|---|---|
| 0 | 1 | false |
Excel formula:
=SPHERICAL_YN(0, 1, FALSE)
Expected output:
-0.540302
Example 2: First order function value
Inputs:
| n | z | derivative |
|---|---|---|
| 1 | 2 | false |
Excel formula:
=SPHERICAL_YN(1, 2, FALSE)
Expected output:
-0.350612
Example 3: Second order derivative value
Inputs:
| n | z | derivative |
|---|---|---|
| 2 | 1.5 | true |
Excel formula:
=SPHERICAL_YN(2, 1.5, TRUE)
Expected output:
1.99499
Example 4: Third order at moderate argument
Inputs:
| n | z | derivative |
|---|---|---|
| 3 | 4 | false |
Excel formula:
=SPHERICAL_YN(3, 4, FALSE)
Expected output:
-0.218642
Python Code
Show Code
from scipy.special import spherical_yn as scipy_spherical_yn
def spherical_yn(n, z, derivative=False):
"""
Compute the spherical Bessel function of the second kind or its derivative.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.spherical_yn.html
This example function is provided as-is without any representation of accuracy.
Args:
n (int): Nonnegative integer order of the spherical Bessel function (dimensionless).
z (float): Positive 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 spherical Bessel function of the second kind (or derivative) at order n and argument z.
"""
try:
n = int(n)
z = float(z)
derivative = bool(derivative)
if n < 0:
return "Error: n must be greater than or equal to 0"
if z <= 0:
return "Error: z must be greater than 0 for real-valued output"
return float(scipy_spherical_yn(n, z, derivative=derivative))
except Exception as e:
return f"Error: {str(e)}"Online Calculator