xnn.gnn.featurizers.spherical_bessel.spherical_bessel_jn#

xnn.gnn.featurizers.spherical_bessel.spherical_bessel_jn(l_max, x, n_terms=30)[source]#

Spherical Bessel functions of the first kind, orders 0 to l_max.

Parameters:
  • l_max (int) – Highest order.

  • x (Tensor) – Arguments of any shape, x >= 0.

  • n_terms (int, optional) – Terms of the power series, by default 30 (double precision over its range of use).

Returns:

j_l(x) stacked along a new last axis, shape (..., l_max + 1), in the dtype of x.

Return type:

Tensor

Notes

Order l uses the power series x^l / (2l+1)!! * sum_k (-x^2/2)^k / (k! (2l+3)(2l+5)...(2l+2k+1)) for x < l + 2 and the upward recurrence j_{l+1} = (2l+1)/x j_l - j_{l-1} from j_0 = sin x / x and j_1 = (sin x / x - cos x) / x beyond; the recurrence loses digits for x below the order, the series needs more terms above it, and the switch at l + 2 keeps both at double precision. The arithmetic is float64 internally.