pub fn heuman_lambda<P, E, V>(phi: V, k: V) -> Vwhere
P: Policy,
E: FloatElement + EllipticConsts,
V: FloatVector<Element = E> + SpecializedSpecialMath<E>,Expand description
Heuman’s lambda function $\Lambda_0(\varphi, k)$.
\Lambda_0(\varphi, k) = \frac{2}{\pi}\Big[E(k) F(\varphi, k') + K(k) E(\varphi, k')
- K(k) F(\varphi, k')\Big]with $k' = \sqrt{1-k^2}$ the complementary modulus. $\Lambda_0(0, k) = 0$ and
$\Lambda_0(\pi/2, k) = 1$, which is what makes it the natural companion to the complete
integral of the third kind. It is also the standard closed form for the off-axis field of a
circular current loop.
Inside $|\varphi| \le \pi/2$ a Carlson form avoids the three-term difference above:
\Lambda_0 = \frac{2}{\pi}\frac{k'^2 \sin\varphi\cos\varphi}{\delta}
\left[R_F(0, k'^2, 1) + \frac{k^2}{3\delta^2} R_J(0, k'^2, 1, p)\right],
\qquad \delta^2 = 1 - k'^2\sin^2\varphiThe parameter p is the delicate part. Its textbook spelling is $1 - k^2/\delta^2$,
which is exactly zero at $\varphi = \pi/2$ and therefore rounds negative just before
it, and a negative fourth argument sends R_J into its Cauchy-principal-value branch,
which is a different function. Since $\delta^2 = k^2 + k'^2\cos^2\varphi$, the parameter
is identically $k'^2\cos^2\varphi/\delta^2$, a ratio of non-negative quantities that is
correct at the endpoint and cannot go negative. Measured against the defining form at 40
digits: 3.6e-15 worst with that spelling, versus a NaN with the textbook one.
Beyond $|\varphi| > \pi/2$ the Carlson form no longer applies and the identity
$\Lambda_0 = F(\varphi,k')/K(k') + \tfrac{2}{\pi}K(k) Z(\varphi, k')$ takes over. That
arm costs three more elliptic evaluations, so it is gated on a lane actually needing it:
the function’s usual domain is $[0, \pi/2]$.