pymiediff.special

pymiediff.special#

Special functions used by pymiediff.

This module provides autograd-friendly spherical Bessel/Hankel functions and their derivatives, together with Riccati-Bessel forms and vector spherical harmonic (VSH) helpers used by Mie coefficient and near-field solvers.

Both SciPy-backed and torch-native recurrence implementations are available. The Peña/Yang log-derivative recurrences are also implemented for stable multilayer computations.

Functions

D1n_torch(n, z[, n_add, n_add_min, ...])

Vectorized D(1)n logrithmic derivative via downward recurrence

D3n_torch(n, z, D1ns[, eps, precision])

Ql_torch(n, l, m, x[, eps])

bessel2ndDer(n, z, bessel, **kwargs)

Evaluate second derivative of a spherical Bessel function.

chi(n, z, **kwargs)

Riccati-Bessel function chi_n(z) and derivative.

chi_torch(n, z, **kwargs)

Torch-native Riccati-Bessel chi_n and derivative.

f_der(n, z, f_n, **kwargs)

Differentiate order-indexed spherical Bessel-like sequences.

pena_D1_n(n, z[, n_add, eps, precision])

Compute D_n^(1)(z) = psi'_n(z) / psi_n(z) by downward recurrence.

pena_D3_n(n, z[, D1, eps, precision])

Compute D_n^(3)(z) = zeta'_n(z) / zeta_n(z) recurrence.

pena_Q_n(n, z1, z2, x1, x2, D1_z1, D1_z2, ...)

Evaluate Peña/Pal interface ratio recurrence Q_n.

pena_psi_zeta_n(n, z, D1, D3[, eps, precision])

Build psi_n and zeta_n sequences from Peña derivatives.

pi_tau(n, mu, **kwargs)

Compute angular functions pi_n and tau_n up to order n.

psi(n, z, **kwargs)

Riccati-Bessel function psi_n(z) and derivative.

psi_torch(n, z, **kwargs)

Torch-native Riccati-Bessel psi_n and derivative.

psi_torch_logdir(n, l, m, x[, eps])

sph_h1n(n, z, **kwargs)

Spherical Hankel function of the first kind.

sph_h1n_der(n, z, **kwargs)

Derivative of spherical Hankel function of the first kind.

sph_h1n_torch(n, z, **kwargs)

Torch-native spherical Hankel function h_n^(1).

sph_jn(n, z, **kwargs)

Spherical Bessel function of the first kind.

sph_jn_der(n, z, **kwargs)

Derivative of spherical Bessel function of the first kind.

sph_jn_torch(n, z[, n_add, max_n_add, ...])

Torch-native j_n via continued-fraction ratios.

sph_jn_torch_via_rec(n, z[, n_add, ...])

Torch-native j_n via downward recurrence.

sph_yn(n, z, **kwargs)

Spherical Bessel function of the second kind.

sph_yn_der(n, z, **kwargs)

Derivative of spherical Bessel function of the second kind.

sph_yn_torch(n, z[, eps])

Torch-native y_n via upward recurrence.

vsh(n_max, k0, n_medium, r, theta, phi, kind)

Compute vector spherical harmonics with standard radial kernels.

vsh_pena(n_max, k0, n_medium, r, theta, phi, ...)

Compute VSH terms using Peña log-derivative recurrences.

xi(n, z, **kwargs)

Riccati-Bessel function xi_n(z) and derivative.

xi_torch(n, z, **kwargs)

Torch-native Riccati-Bessel xi_n and derivative.

xi_torch_logdir(n, l, m, x[, eps])