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

Function numericTendsToInfinity

src/compute-engine/symbolic/limit.ts:756–771  ·  view source on GitHub ↗
(
  e: Expression,
  x: string,
  ce: ComputeEngine
)

Source from the content-addressed store, hash-verified

754 const n = leadingOrder(num, x, ce, depth).simplify();
755 const d = leadingOrder(den, x, ce, depth).simplify();
756
757 // Compare growth *first*. (Simplifying the quotient first can re-expand it
758 // back into the original product and loop — e.g. x/(1/ln(1+a/x)).)
759 const cmp = compareGrowth(n, d, x, ce);
760 if (cmp !== undefined) {
761 if (cmp < 0) return ce.Zero; // numerator grows slower → 0
762 if (cmp > 0) {
763 // The sign of each term is read from a numeric probe. A probe with no
764 // value (a symbolic coefficient, as in `a·eˣ/x`) leaves the sign of
765 // the infinity undecided: decline.
766 const sn = numericAt(n, x, 120, ce);
767 const sd = numericAt(d, x, 120, ce);
768 if (Number.isNaN(sn) || Number.isNaN(sd) || sn === 0 || sd === 0)
769 return undefined;
770 return sn < 0 !== sd < 0 ? ce.NegativeInfinity : ce.PositiveInfinity;
771 }
772 // Same growth order → ratio of leading coefficients.
773 const r = n.div(d).simplify();
774 if (!r.has(x)) return r.evaluate();

Callers 1

tendsToInfinityFunction · 0.85

Calls 4

numericAtFunction · 0.85
mapMethod · 0.65
absMethod · 0.65
isNaNMethod · 0.45

Tested by

no test coverage detected