MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / erfi

Function erfi

src/compute-engine/numerics/special-functions.ts:2731–2747  ·  view source on GitHub ↗
(x: number)

Source from the content-addressed store, hash-verified

2729
2730 if (x < -9) {
2731 const [P, Q, cosA, sinA, pref] = airyNegPartsPrime(-x);
2732 return pref * (cosA * P + sinA * Q); // DLMF 9.7.12
2733 }
2734
2735 const [fp, gp] = airySeriesFGPrime(x);
2736 return ddMul(SQRT3_DD, ddAdd(ddMul(AIRY_C1, fp), ddMul(AIRY_C2, gp)))[0];
2737}
2738
2739// ──────────────────────────────────────────────────────────────────
2740// Fresnel integrals
2741//
2742// S(x) = ∫₀ˣ sin(π t²/2) dt
2743// C(x) = ∫₀ˣ cos(π t²/2) dt
2744//
2745// Rational Chebyshev approximation from Cephes / scipy.
2746// Three regions: |x|<1.6, 1.6≤|x|<36, |x|≥36.
2747// ──────────────────────────────────────────────────────────────────
2748
2749// Region 1 (|x| < 1.6): S(x) = x³ P(x⁴)/Q(x⁴)
2750// Coefficients from Cephes (π/2 factor is baked into the coefficients)

Callers 1

statistics.tsFile · 0.90

Calls 4

absMethod · 0.65
sqrtMethod · 0.65
isNaNMethod · 0.45
isFiniteMethod · 0.45

Tested by

no test coverage detected