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

Function kummer1F1SeriesC

src/compute-engine/numerics/numeric-complex.ts:842–860  ·  view source on GitHub ↗
(
  a: Complex,
  b: Complex,
  z: Complex,
  maxTerms = 20_000
)

Source from the content-addressed store, hash-verified

840 return y < 0 || (y === 0 && x < 0)
841 ? new Complex(phi, -l)
842 : new Complex(-phi, l);
843 }
844 // 1 − w = (z − 1)/z and 1 + w = (z + 1)/z, with w = 1/z.
845 let p: { re: number; im: number };
846 let q: { re: number; im: number };
847 if (y === 0) {
848 // A real w: the imaginary part is the zero of `complexAcos()`.
849 const wi = x > 0 ? -0 : 0;
850 p = { re: (x - 1) / x, im: -wi };
851 q = { re: (x + 1) / x, im: wi };
852 } else if (h > 2) {
853 // |w| < 1/2: 1 ± w has no cancellation, while z ± 1 would lose the 1.
854 const w = complexQuotient(1, 0, x, y);
855 p = { re: 1 - w.re, im: -w.im };
856 q = { re: 1 + w.re, im: w.im };
857 } else {
858 p = complexQuotient(x - 1, y, x, y);
859 q = complexQuotient(x + 1, y, x, y);
860 }
861 const [ar, ai] = sqrtParts(p.re, p.im); // √(1 − w)
862 const [br, bi] = sqrtParts(q.re, q.im); // √(1 + w)
863 return new Complex(2 * Math.atan2(ar, br), Math.asinh(br * ai - bi * ar));

Callers 1

hypergeometric1F1ComplexFunction · 0.85

Calls 5

divMethod · 0.65
mulMethod · 0.65
addMethod · 0.65
isZeroMethod · 0.65
absMethod · 0.65

Tested by

no test coverage detected