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

Function toExpr

src/compute-engine/rubi/rubi-utils.ts:393–400  ·  view source on GitHub ↗
(cs: Expression[])

Source from the content-addressed store, hash-verified

391 const deg = ms.reduce((m, [, d]) => Math.max(m, d), 0);
392 const coeffs: Expression[] = new Array(deg + 1).fill(ce.Zero);
393 for (const [c, d] of ms) coeffs[d] = coeffs[d].add(c);
394 return coeffs.map((c) => c.evaluate());
395}
396
397/** effective degree after dropping provably-zero leading coefficients */
398function trimZeros(coeffs: Expression[]): Expression[] {
399 let last = coeffs.length - 1;
400 while (last > 0 && zeroQ(coeffs[last])) last--;
401 return coeffs.slice(0, last + 1);
402}
403

Callers 1

polyDivideXFunction · 0.85

Calls 6

zeroQFunction · 0.85
safeSimplifyFunction · 0.85
mapMethod · 0.65
mulMethod · 0.65
powMethod · 0.65
functionMethod · 0.65

Tested by

no test coverage detected