Skip to main content

carlson_rg

Function carlson_rg 

Source
pub fn carlson_rg<P, E, V>(x: V, y: V, z: V) -> V
where P: Policy, E: FloatElement + EllipticConsts, V: FloatVector<Element = E>,
Expand description

Carlson symmetric integral of the second kind, R_G(x, y, z), as a combination of carlson_rf and carlson_rd (Carlson 2015):

R_G = (z * R_F(x,y,z) - (x-z)(y-z) * R_D(x,y,z) / 3 + sqrt(x*y/z)) / 2

The arguments are sorted to hi >= mid >= lo and substituted as x = hi, z = mid, y = lo, the ordering that keeps (x-z)(y-z) from cancelling and puts the middle value (the divisor) in z. That form needs mid > 0; two or more zero arguments divide by it, so under check_overflow they take the closed form R_G(x, 0, 0) = sqrt(x)/2 instead (which also covers R_G(0,0,0) = 0). Unlike R_F/R_D/R_J, R_G stays finite there. Not wired into the public ellint surface - no Legendre form needs it; provided for direct use (e.g. E(k) = 2 R_G(0, 1-k^2, 1)).

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