SpheroidalWaves.jl: a Julia package for computing spheroidal wave functions

Hi all,

I wanted to share a Julia package I’ve been working on that may be useful for folks doing analytical or hybrid acoustic scattering work: SpheroidalWaves.jl.

Motivation: Spheroidal wave functions are the natural basis for scattering from elongated targets with different boundary conditions (e.g., pressure-release and liquid-filled cases). Several repositories expose these functions to varying degrees, including echoSMs [Python/Fortran], Prol_Spheroid [Python/Fortran], liquid_spheroid [Julia], scattering [MATLAB/C++], acousticTS [R/C++/Fortran]. While some provide user-facing functions (e.g., echoSMs, acousticTS), many workflows still need a lean implementation that avoids large dependency overhead and is straightforward to embed in custom pipelines. This package targets that gap: a lightweight, solver-focused interface that is easy to integrate, fast for large parameter sweeps and inverse problems, and explicit about numerical behavior through built-in diagnostic and accuracy metadata. It is designed as a reproducible computational kernel layer, so users can compose it with their existing modeling stack while retaining performance and transparency.

What’s included:

Function Description
smn(m, n, c, η; normalize=true) Angular wave functions + derivatives
rmn(m, n, c, x; kind=1..4) Radial wave functions + derivatives (all four kinds)
eigenvalue(m, n, c) Separation constant λₘₙ(c)
radial_wronskian(m, n, c, x) Wronskian diagnostic for solver quality
accuracy(m, n, c, arg) Backend-estimated decimal digit accuracy
jacobian_eigen/smn/rmn Numerical Jacobians w.r.t. c
find_c_for_eigenvalue Root-finding: solve λₘₙ(c) = target

Key features:

  • Prolate and oblate geometries; real and complex c

  • True batch vectorization within Fortran kernels (around ~100× faster than looping in Julia)

  • Double (default) and quad precision dispatch at runtime

  • Artifacts-first install; falls back to local CMake/gfortran build automatically if needed

Upstream credit: The numerical kernels are built on top of the Van Buren & Boisvert Fortran solvers (prolate, oblate, complex prolate, complex oblate). This package adds the batch C-ABI wrappers, Julia dispatch layer, precision routing, and analysis utilities.

Links:

Issues and PRs welcome!

1 Like