pymiediff.special.sph_jn_torch_via_rec

pymiediff.special.sph_jn_torch_via_rec#

pymiediff.special.sph_jn_torch_via_rec(n: Tensor, z: Tensor, n_add='auto', n_add_min=10, n_add_max=35, eps=1e-10, precision='double', **kwargs)#

Torch-native j_n via downward recurrence.

BEWARE: With this implementaion there is a singularity at z=pi, and the renormalization of the downward recurrence will fail. The logarithmic derivatives implmentations, do not pose this risk.

Parameters:
  • n (int or torch.Tensor) – Maximum order.

  • z (torch.Tensor) – Complex argument(s).

  • n_add ({"auto"} or int, default="auto") – Extra starting depth for downward sweep.

  • n_add_min (int, default=10) – Minimum automatic extra depth.

  • n_add_max (int, default=35) – Maximum automatic extra depth.

  • eps (float, default=1e-10) – Small-argument safeguard.

  • precision ({"single", "double"}, default="double") – Complex dtype selection.

Returns:

j_n(z) for orders 0..n.

Return type:

torch.Tensor