Skip to main content

sph_deriv_n

Function sph_deriv_n 

Source
pub fn sph_deriv_n<E, V, const N: usize, const MINUS: bool>(
    x: V,
    prev: V,
    cur: V,
) -> V
where E: FloatElement, V: FloatVector<Element = E>,
Expand description

$f_n'(x)$ from the pair the walk returns: $f_n' = \pm f_{n-1} - \frac{n+1}{x} f_n$.

MINUS selects the $k$ case, whose neighbour enters negated, the same asymmetry the cylindrical $K$ has, and for the same reason: $K$ is the decaying solution, so its derivative is negative where the others’ are not.

§Where this comes from

Not a separate identity: the cylindrical one plus the derivative of the normalization. With $f_n = \sqrt{\pi/2x}\,F_{n+1/2}$ and $F_\nu' = F_{\nu-1} - \frac{\nu}{x}F_\nu$, the extra $-\frac{1}{2x}$ from differentiating $\sqrt{\pi/2x}$ turns $\frac{n+1/2}{x}$ into $\frac{n+1}{x}$. That is the whole difference. It is why the coefficient is $n+1$ rather than the $n$ a half-remembered version of this formula would use.

Last built: 2026-09-08 21:35:55 UTC